]> git.ipfire.org Git - thirdparty/bugzilla.git/commitdiff
Bug 286205: Bugzilla Header shown twice if I try to add user without specifying the...
authorlpsolit%gmail.com <>
Tue, 21 Jun 2005 21:20:49 +0000 (21:20 +0000)
committerlpsolit%gmail.com <>
Tue, 21 Jun 2005 21:20:49 +0000 (21:20 +0000)
editusers.cgi
globals.pl
token.cgi

index 040720cb94918ddb7551fb5302a0420fa05cc988..1d10304ab75422b11c4c3c5b1274531125ca85c2 100755 (executable)
@@ -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.<BR>\n";
-        } else {
-            print "Did not update password: $passworderror<br>\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.<BR>\n";
     }
     if ($editall && $realname ne $realnameold) {
         SendSQL("UPDATE profiles
index 32f11dad5223682f8789d10f2df5cc43907aab25..429d93bc0c06058c5dda0ace30eacfb6ae01c5db 100644 (file)
@@ -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);
     }
 }
 
index 36508f0a538a2543a69b5357ecf36cb955c8253c..5e45f9e576503c2dc187235f9375d61416ced38b 100755 (executable)
--- 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();