From fc99fef185a7877acb98613b60586c7f491444db Mon Sep 17 00:00:00 2001 From: Frédéric Buclin Date: Fri, 15 Oct 2010 02:10:55 +0200 Subject: Bug 604522: t/012throwables.t doesn't catch new user errors correctly r/a=mkanat --- Bugzilla/Auth.pm | 2 +- Bugzilla/Auth/Verify/DB.pm | 4 ++-- t/012throwables.t | 6 +++--- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/Bugzilla/Auth.pm b/Bugzilla/Auth.pm index f289a4ba1..e3f838b39 100644 --- a/Bugzilla/Auth.pm +++ b/Bugzilla/Auth.pm @@ -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}); diff --git a/Bugzilla/Auth/Verify/DB.pm b/Bugzilla/Auth/Verify/DB.pm index c562d1353..2fcfd4017 100644 --- a/Bugzilla/Auth/Verify/DB.pm +++ b/Bugzilla/Auth/Verify/DB.pm @@ -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 diff --git a/t/012throwables.t b/t/012throwables.t index 4be02c58a..3738ad524 100644 --- a/t/012throwables.t +++ b/t/012throwables.t @@ -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; } } -- cgit v1.2.3-24-g4f1b