summaryrefslogtreecommitdiffstats
path: root/token.cgi
diff options
context:
space:
mode:
authorFrédéric Buclin <LpSolit@gmail.com>2011-08-16 14:31:32 +0200
committerFrédéric Buclin <LpSolit@gmail.com>2011-08-16 14:31:32 +0200
commit0fdd3872606a6a51a73fe6dff0d2c0c320f1fba1 (patch)
tree502727052ab24940df3d6a06f271b0f95d94a112 /token.cgi
parent47b092002eca10bbc9f87f6ac5da77bdf0f36832 (diff)
downloadbugzilla-0fdd3872606a6a51a73fe6dff0d2c0c320f1fba1.tar.gz
bugzilla-0fdd3872606a6a51a73fe6dff0d2c0c320f1fba1.tar.xz
Fix complains from 012throwables.t due to bug 677901
Diffstat (limited to 'token.cgi')
-rwxr-xr-xtoken.cgi17
1 files changed, 9 insertions, 8 deletions
diff --git a/token.cgi b/token.cgi
index d085e88e6..c43acdbfd 100755
--- 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);
}
}