From: lpsolit%gmail.com <> Date: Tue, 21 Jun 2005 21:20:49 +0000 (+0000) Subject: Bug 286205: Bugzilla Header shown twice if I try to add user without specifying the... X-Git-Tag: bugzilla-2.18.2~12 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=5e0b5badae00865e9ae6ee10e511886218272a80;p=thirdparty%2Fbugzilla.git Bug 286205: Bugzilla Header shown twice if I try to add user without specifying the password - Patch by Marc Schumann r=LpSolit a=justdave --- diff --git a/editusers.cgi b/editusers.cgi index 040720cb94..1d10304ab7 100755 --- a/editusers.cgi +++ b/editusers.cgi @@ -467,12 +467,7 @@ if ($action eq 'new') { PutTrailer($localtrailer); exit; } - my $passworderror = ValidatePassword($password); - if ( $passworderror ) { - print $passworderror; - PutTrailer($localtrailer); - exit; - } + ValidatePassword($password); # Add the new user SendSQL("INSERT INTO profiles ( " . @@ -820,22 +815,18 @@ if ($action eq 'update') { # Update the database with the user's new password if they changed it. if ( Bugzilla::Auth->can_edit && $editall && $password ) { - my $passworderror = ValidatePassword($password); - if ( !$passworderror ) { - my $cryptpassword = SqlQuote(Crypt($password)); - my $loginname = SqlQuote($userold); - SendSQL("UPDATE profiles - SET cryptpassword = $cryptpassword - WHERE login_name = $loginname"); - SendSQL("SELECT userid - FROM profiles - WHERE login_name=" . SqlQuote($userold)); - my $userid = FetchOneColumn(); - Bugzilla->logout_user_by_id($userid); - print "Updated password.
\n"; - } else { - print "Did not update password: $passworderror
\n"; - } + ValidatePassword($password); + my $cryptpassword = SqlQuote(Crypt($password)); + my $loginname = SqlQuote($userold); + SendSQL("UPDATE profiles + SET cryptpassword = $cryptpassword + WHERE login_name = $loginname"); + SendSQL("SELECT userid + FROM profiles + WHERE login_name=" . SqlQuote($userold)); + my $userid = FetchOneColumn(); + Bugzilla->logout_user_by_id($userid); + print "Updated password.
\n"; } if ($editall && $realname ne $realnameold) { SendSQL("UPDATE profiles diff --git a/globals.pl b/globals.pl index 32f11dad52..429d93bc0c 100644 --- a/globals.pl +++ b/globals.pl @@ -727,11 +727,11 @@ sub ValidatePassword { my ($password, $matchpassword) = @_; if (length($password) < 3) { - ThrowUserError("password_too_short"); + ThrowUserError("password_too_short", $::vars); } elsif (length($password) > 16) { - ThrowUserError("password_too_long"); + ThrowUserError("password_too_long", $::vars); } elsif ((defined $matchpassword) && ($password ne $matchpassword)) { - ThrowUserError("passwords_dont_match"); + ThrowUserError("passwords_dont_match", $::vars); } } diff --git a/token.cgi b/token.cgi index 36508f0a53..5e45f9e576 100755 --- a/token.cgi +++ b/token.cgi @@ -66,11 +66,7 @@ if ($cgi->param('t')) { $::quotedtoken = SqlQuote($::token); # Make sure the token contains only valid characters in the right amount. - my $validationerror = ValidatePassword($::token); - if ($validationerror) { - ThrowUserError("token_invalid"); - } - + ValidatePassword($::token); Bugzilla::Token::CleanTokenTable();