From b76a02502d1e3abf05d8aef379d14ac259619526 Mon Sep 17 00:00:00 2001 From: "terry%mozilla.org" <> Date: Thu, 13 May 1999 00:20:39 +0000 Subject: Added user preference controlling how much email they get. --- changepassword.cgi | 100 ++++++++++++++++++++++++++++++++++++++--------------- 1 file changed, 72 insertions(+), 28 deletions(-) (limited to 'changepassword.cgi') diff --git a/changepassword.cgi b/changepassword.cgi index a3a17e39a..25ea4e7c3 100755 --- a/changepassword.cgi +++ b/changepassword.cgi @@ -23,28 +23,65 @@ require "CGI.pl"; confirm_login(); -if (! defined $::FORM{'pwd1'}) { - print "Content-type: text/html +print "Content-type: text/html\n\n"; -

Change your password

+if (! defined $::FORM{'pwd1'}) { + PutHeader("Preferences", "Change your password and other preferences", + $::COOKIE{'Bugzilla_login'}); + + my $qacontactpart = ""; + if (Param('useqacontact')) { + $qacontactpart = ", the current QA Contact"; + } + SendSQL("select emailnotification from profiles where login_name = " . + SqlQuote($::COOKIE{'Bugzilla_login'})); + my ($emailnotification) = (FetchSQLData()); + print qq{
+
- + - + +
Please enter the new password for $::COOKIE{'Bugzilla_login'}:
Re-enter your new password:
+
+ + + + +
Bugzilla will send out email notification of changed bugs to +the current owner, the submitter of the bug$qacontactpart, and anyone on the +CC list. However, you can suppress some of those email notifications. +On which of these bugs would you like email notification of changes? +
-\n"; +
+ +
+"; + navigation_header(); exit; } if ($::FORM{'pwd1'} ne $::FORM{'pwd2'}) { - print "Content-type: text/html - -

Try again.

+ print "

Try again.

The two passwords you entered did not match. Please click Back and try again.\n"; exit; } @@ -53,36 +90,43 @@ The two passwords you entered did not match. Please click Back and try a my $pwd = $::FORM{'pwd1'}; -if ($pwd !~ /^[a-zA-Z0-9-_]*$/ || length($pwd) < 3 || length($pwd) > 15) { - print "Content-type: text/html +sub x { + my $sc="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789./"; + return substr($sc, int (rand () * 100000) % (length ($sc) + 1), 1); +} -

Sorry; we're picky.

+if ($pwd ne "") { + if ($pwd !~ /^[a-zA-Z0-9-_]*$/ || length($pwd) < 3 || length($pwd) > 15) { + print "

Sorry; we're picky.

Please choose a password that is between 3 and 15 characters long, and that contains only numbers, letters, hyphens, or underlines.

Please click Back and try again.\n"; - exit; -} - - -print "Content-type: text/html\n\n"; - + exit; + } + + # Generate a random salt. - -sub x { - my $sc="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789./"; - return substr($sc, int (rand () * 100000) % (length ($sc) + 1), 1); + + my $salt = x() . x(); + + my $encrypted = crypt($pwd, $salt); + + SendSQL("update profiles set password='$pwd',cryptpassword='$encrypted' where login_name=" . + SqlQuote($::COOKIE{'Bugzilla_login'})); + + SendSQL("update logincookies set cryptpassword = '$encrypted' where cookie = $::COOKIE{'Bugzilla_logincookie'}"); } -my $salt = x() . x(); -my $encrypted = crypt($pwd, $salt); -SendSQL("update profiles set password='$pwd',cryptpassword='$encrypted' where login_name=" . +SendSQL("update profiles set emailnotification='$::FORM{'emailnotification'}' where login_name = " . SqlQuote($::COOKIE{'Bugzilla_login'})); -SendSQL("update logincookies set cryptpassword = '$encrypted' where cookie = $::COOKIE{'Bugzilla_logincookie'}"); -print "

OK, done.

-Your new password has been set. +PutHeader("Preferences updated."); + + +print " +Your preferences have been updated.

Back to query page.\n"; -- cgit v1.2.3-24-g4f1b