From: jocuri%softhome.net <> Date: Wed, 3 Mar 2004 13:20:43 +0000 (+0000) Subject: Patch for bug 123077; improve the ValidatePassword sub so that a password change... X-Git-Tag: bugzilla-2.16.5~2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b257b6c09a4c18a011c236453553c4dc91b6425b;p=thirdparty%2Fbugzilla.git Patch for bug 123077; improve the ValidatePassword sub so that a password change is no longer accepted with a blank second field; r=kiko, a=justdave. --- diff --git a/globals.pl b/globals.pl index ca20265e3b..f76676597e 100644 --- a/globals.pl +++ b/globals.pl @@ -856,7 +856,7 @@ sub ValidatePassword { return "The password is less than three characters long. It must be at least three characters."; } elsif ( length($password) > 16 ) { return "The password is more than 16 characters long. It must be no more than 16 characters."; - } elsif ( $matchpassword && $password ne $matchpassword ) { + } elsif ( (defined $matchpassword) && ($password ne $matchpassword) ) { return "The two passwords do not match."; } diff --git a/userprefs.cgi b/userprefs.cgi index 3a6a58463b..d105ede529 100755 --- a/userprefs.cgi +++ b/userprefs.cgi @@ -108,15 +108,11 @@ sub SaveAccount { if ($pwd1 ne "" || $pwd2 ne "") { - if ($pwd1 ne $pwd2) { - DisplayError("The two passwords you entered did not match."); - exit; - } if ($::FORM{'new_password1'} eq '') { DisplayError("You must enter a new password."); exit; } - my $passworderror = ValidatePassword($pwd1); + my $passworderror = ValidatePassword($pwd1, $pwd2); (DisplayError($passworderror) && exit) if $passworderror; my $cryptedpassword = SqlQuote(Crypt($pwd1));