diff options
author | Koosha Khajeh Moogahi <koosha.khajeh@gmail.com> | 2012-05-18 16:36:12 +0200 |
---|---|---|
committer | Frédéric Buclin <LpSolit@gmail.com> | 2012-05-18 16:36:12 +0200 |
commit | cb114a086e9d68706f326adcc30b149fb06170d1 (patch) | |
tree | 98d0a3f2e75363f912cbe914ce8ac451544ad6b3 /token.cgi | |
parent | 7298d3241bea1272ba316c437007d9c07c4ed8b4 (diff) | |
download | bugzilla-cb114a086e9d68706f326adcc30b149fb06170d1.tar.gz bugzilla-cb114a086e9d68706f326adcc30b149fb06170d1.tar.xz |
Bug 752303: It is no longer possible to cancel an email address change when this one has already been confirmed
r/a=LpSolit
Diffstat (limited to 'token.cgi')
-rwxr-xr-x | token.cgi | 19 |
1 files changed, 5 insertions, 14 deletions
@@ -193,7 +193,6 @@ sub confirmChangeEmail { sub changeEmail { my ($userid, $eventdata, $token) = @_; my $dbh = Bugzilla->dbh; - my ($old_email, $new_email) = split(/:/,$eventdata); # Check the user entered the correct old email address @@ -208,21 +207,15 @@ sub changeEmail { ThrowUserError("account_exists", { email => $new_email } ); } - # Update the user's login name in the profiles table and delete the token - # from the tokens table. $dbh->bz_start_transaction(); - $dbh->do(q{UPDATE profiles - SET login_name = ? - WHERE userid = ?}, - undef, ($new_email, $userid)); + my $user = Bugzilla::User->check({ id => $userid }); + # Update the user's login name in the profiles table. + $user->set_login($new_email); + $user->update({ keep_session => 1, keep_tokens => 1 }); delete_token($token); $dbh->do(q{DELETE FROM tokens WHERE userid = ? AND tokentype = 'emailnew'}, undef, $userid); - # The email address has been changed, so we need to rederive the groups - my $user = new Bugzilla::User($userid); - $user->derive_regexp_groups; - $dbh->bz_commit_transaction(); # Return HTTP response headers. @@ -250,9 +243,7 @@ sub cancelChangeEmail { # check to see if it has been altered if ($user->login ne $old_email) { $user->set_login($old_email); - $user->update(); - # email has changed, so rederive groups - $user->derive_regexp_groups; + $user->update({ keep_session => 1 }); $vars->{'message'} = "email_change_canceled_reinstated"; } |