]> git.ipfire.org Git - thirdparty/bugzilla.git/commitdiff
Fix complains from 012throwables.t due to bug 677901
authorFrédéric Buclin <LpSolit@gmail.com>
Tue, 16 Aug 2011 12:31:32 +0000 (14:31 +0200)
committerFrédéric Buclin <LpSolit@gmail.com>
Tue, 16 Aug 2011 12:31:32 +0000 (14:31 +0200)
token.cgi

index d085e88e6c524602d256360e62372979f5d228fc..c43acdbfd0a5a637d596da444b70959de58a9bf0 100755 (executable)
--- a/token.cgi
+++ b/token.cgi
@@ -56,27 +56,28 @@ unless ($action eq 'reqpw') {
     $tokentype || ThrowUserError("token_does_not_exist");
 
     # Make sure the token is the correct type for the action being taken.
-    my $error;
+    # The { user_error => 'wrong_token_for_*' } trick is to make 012throwables.t happy.
+    my $error = {};
     if (grep($action eq $_ , qw(cfmpw cxlpw chgpw)) && $tokentype ne 'password') {
-        $error = 'wrong_token_for_changing_passwd';
+        $error = { user_error => 'wrong_token_for_changing_passwd' };
     }
     elsif ($action eq 'cxlem'
            && ($tokentype ne 'emailold' && $tokentype ne 'emailnew'))
     {
-        $error = 'wrong_token_for_cancelling_email_change';
+        $error = { user_error => 'wrong_token_for_cancelling_email_change' };
     }
     elsif (grep($action eq $_ , qw(cfmem chgem)) && $tokentype ne 'emailnew') {
-        $error = 'wrong_token_for_confirming_email_change';
+        $error = { user_error => 'wrong_token_for_confirming_email_change' };
     }
     elsif ($action =~ /^(request|confirm|cancel)_new_account$/
            && $tokentype ne 'account')
     {
-        $error = 'wrong_token_for_creating_account';
+        $error = { user_error => 'wrong_token_for_creating_account' };
     }
 
-    if ($error) {
-        Bugzilla::Token::Cancel($token, $error);
-        ThrowUserError($error);
+    if (my $user_error = $error->{user_error}) {
+        Bugzilla::Token::Cancel($token, $user_error);
+        ThrowUserError($user_error);
     }
 }