]> git.ipfire.org Git - thirdparty/bugzilla.git/commitdiff
Bug 604522: t/012throwables.t doesn't catch new user errors correctly
authorFrédéric Buclin <LpSolit@gmail.com>
Fri, 15 Oct 2010 00:13:34 +0000 (02:13 +0200)
committerFrédéric Buclin <LpSolit@gmail.com>
Fri, 15 Oct 2010 00:13:34 +0000 (02:13 +0200)
r/a=mkanat

Bugzilla/Auth.pm
Bugzilla/Auth/Verify/DB.pm
t/012throwables.t

index f289a4ba11431bf195f86cab294df1691b5ebb2e..e3f838b3952869d62cfff2fb825c10c164b5cc86 100644 (file)
@@ -152,7 +152,7 @@ sub _handle_login_result {
     }
     elsif ($fail_code == AUTH_ERROR) {
         if ($result->{user_error}) {
-            ThrowUserError($result->{error}, $result->{details});
+            ThrowUserError($result->{user_error}, $result->{details});
         }
         else {
             ThrowCodeError($result->{error}, $result->{details});
index c562d13536820758596b4df55a5d34b295bc25ab..2fcfd401736aa9fb8e408f5897bb6747a2ca1697 100644 (file)
@@ -76,8 +76,8 @@ sub check_credentials {
 
     # Force the user to type a longer password if it's too short.
     if (length($password) < USER_PASSWORD_MIN_LENGTH) {
-        return { failure => AUTH_ERROR, error => 'password_current_too_short',
-                 user_error => 1, details => { locked_user => $user } };
+        return { failure => AUTH_ERROR, user_error => 'password_current_too_short',
+                 details => { locked_user => $user } };
     }
 
     # The user's credentials are okay, so delete any outstanding
index 4be02c58a88467572d127f0e59aec78d758a8372..3738ad52435c8cf70a82004171e20e9ad80ad034 100644 (file)
@@ -117,7 +117,7 @@ foreach my $file (keys %test_modules) {
                                         # Bugzilla/Error.pm)
         $lineno++;
         if ($line =~
-/^[^#]*(Throw(Code|User)Error|error\s+=>)\s*\(?\s*["'](.*?)['"]/) {
+/^[^#]*\b(Throw(Code|User)Error|(user_)?error\s+=>)\s*\(?\s*["'](.*?)['"]/) {
             my $errtype;
             # If it's a normal ThrowCode/UserError
             if ($2) {
@@ -125,9 +125,9 @@ foreach my $file (keys %test_modules) {
             }
             # If it's an AUTH_ERROR tag
             else {
-                $errtype = 'code';
+                $errtype = $3 ? 'user' : 'code';
             }
-            my $errtag = $3;
+            my $errtag = $4;
             push @{$Errors{$errtype}{$errtag}{used_in}{$file}}, $lineno;
         }
     }