Commit fc99fef1 authored by Frédéric Buclin's avatar Frédéric Buclin

Bug 604522: t/012throwables.t doesn't catch new user errors correctly

r/a=mkanat
parent e60d388f
...@@ -152,7 +152,7 @@ sub _handle_login_result { ...@@ -152,7 +152,7 @@ sub _handle_login_result {
} }
elsif ($fail_code == AUTH_ERROR) { elsif ($fail_code == AUTH_ERROR) {
if ($result->{user_error}) { if ($result->{user_error}) {
ThrowUserError($result->{error}, $result->{details}); ThrowUserError($result->{user_error}, $result->{details});
} }
else { else {
ThrowCodeError($result->{error}, $result->{details}); ThrowCodeError($result->{error}, $result->{details});
......
...@@ -76,8 +76,8 @@ sub check_credentials { ...@@ -76,8 +76,8 @@ sub check_credentials {
# Force the user to type a longer password if it's too short. # Force the user to type a longer password if it's too short.
if (length($password) < USER_PASSWORD_MIN_LENGTH) { if (length($password) < USER_PASSWORD_MIN_LENGTH) {
return { failure => AUTH_ERROR, error => 'password_current_too_short', return { failure => AUTH_ERROR, user_error => 'password_current_too_short',
user_error => 1, details => { locked_user => $user } }; details => { locked_user => $user } };
} }
# The user's credentials are okay, so delete any outstanding # The user's credentials are okay, so delete any outstanding
......
...@@ -117,7 +117,7 @@ foreach my $file (keys %test_modules) { ...@@ -117,7 +117,7 @@ foreach my $file (keys %test_modules) {
# Bugzilla/Error.pm) # Bugzilla/Error.pm)
$lineno++; $lineno++;
if ($line =~ if ($line =~
/^[^#]*(Throw(Code|User)Error|error\s+=>)\s*\(?\s*["'](.*?)['"]/) { /^[^#]*\b(Throw(Code|User)Error|(user_)?error\s+=>)\s*\(?\s*["'](.*?)['"]/) {
my $errtype; my $errtype;
# If it's a normal ThrowCode/UserError # If it's a normal ThrowCode/UserError
if ($2) { if ($2) {
...@@ -125,9 +125,9 @@ foreach my $file (keys %test_modules) { ...@@ -125,9 +125,9 @@ foreach my $file (keys %test_modules) {
} }
# If it's an AUTH_ERROR tag # If it's an AUTH_ERROR tag
else { else {
$errtype = 'code'; $errtype = $3 ? 'user' : 'code';
} }
my $errtag = $3; my $errtag = $4;
push @{$Errors{$errtype}{$errtag}{used_in}{$file}}, $lineno; push @{$Errors{$errtype}{$errtag}{used_in}{$file}}, $lineno;
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment