Commit 0fdd3872 authored by Frédéric Buclin's avatar Frédéric Buclin

Fix complains from 012throwables.t due to bug 677901

parent 47b09200
...@@ -56,27 +56,28 @@ unless ($action eq 'reqpw') { ...@@ -56,27 +56,28 @@ unless ($action eq 'reqpw') {
$tokentype || ThrowUserError("token_does_not_exist"); $tokentype || ThrowUserError("token_does_not_exist");
# Make sure the token is the correct type for the action being taken. # 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') { 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' elsif ($action eq 'cxlem'
&& ($tokentype ne 'emailold' && $tokentype ne 'emailnew')) && ($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') { 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$/ elsif ($action =~ /^(request|confirm|cancel)_new_account$/
&& $tokentype ne 'account') && $tokentype ne 'account')
{ {
$error = 'wrong_token_for_creating_account'; $error = { user_error => 'wrong_token_for_creating_account' };
} }
if ($error) { if (my $user_error = $error->{user_error}) {
Bugzilla::Token::Cancel($token, $error); Bugzilla::Token::Cancel($token, $user_error);
ThrowUserError($error); ThrowUserError($user_error);
} }
} }
......
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