r105798 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r105797‎ | r105798 | r105799 >
Date:15:31, 11 December 2011
Author:reedy
Status:ok
Tags:
Comment:
* (bug 32960) remove EmailAuthenticationTimestamp from database when a
email address is removed

In Preferences::trySetUserEmail no point trying to reset the users email if it's the same

Same for User::setEmail

After setting the email though, invalidate email auth tokens
Modified paths:
  • /trunk/phase3/RELEASE-NOTES-1.19 (modified) (history)
  • /trunk/phase3/includes/Preferences.php (modified) (history)
  • /trunk/phase3/includes/User.php (modified) (history)

Diff [purge]

Index: trunk/phase3/RELEASE-NOTES-1.19
@@ -176,6 +176,8 @@
177177 * (bug 31212) History tab not collapsed when the screen is narrow
178178 * (bug 15521) Use new section summary when the action of adding a new section
179179 also happens to create the page
 180+* (bug 32960) remove EmailAuthenticationTimestamp from database when a
 181+ email address is removed
180182
181183 === API changes in 1.19 ===
182184 * (bug 19838) siprop=interwikimap can now use the interwiki cache.
Index: trunk/phase3/includes/Preferences.php
@@ -1428,8 +1428,6 @@
14291429 # The user has supplied a new email address on the login page
14301430 # new behaviour: set this new emailaddr from login-page into user database record
14311431 $user->setEmail( $newaddr );
1432 - # But flag as "dirty" = unauthenticated
1433 - $user->invalidateEmail();
14341432 if ( $wgEmailAuthentication ) {
14351433 # Mail a temporary password to the dirty address.
14361434 # User can come back through the confirmation URL to re-enable email.
@@ -1440,7 +1438,7 @@
14411439 }
14421440 $info = 'eauth';
14431441 }
1444 - } else {
 1442+ } elseif ( $newaddr != $oldaddr ) { // if the address is the same, don't change it
14451443 $user->setEmail( $newaddr );
14461444 }
14471445 if ( $oldaddr != $newaddr ) {
@@ -1474,7 +1472,7 @@
14751473 class PreferencesForm extends HTMLForm {
14761474 // Override default value from HTMLForm
14771475 protected $mSubSectionBeforeFields = false;
1478 -
 1476+
14791477 private $modifiedUser;
14801478
14811479 public function setModifiedUser( $user ) {
@@ -1553,7 +1551,7 @@
15541552 function getBody() {
15551553 return $this->displaySection( $this->mFieldTree, '', 'mw-prefsection-' );
15561554 }
1557 -
 1555+
15581556 /**
15591557 * Get the <legend> for a given section key. Normally this is the
15601558 * prefs-$key message but we'll allow extensions to override it.
Index: trunk/phase3/includes/User.php
@@ -2110,7 +2110,11 @@
21112111 */
21122112 public function setEmail( $str ) {
21132113 $this->load();
 2114+ if( $str == $this->mEmail ) {
 2115+ return;
 2116+ }
21142117 $this->mEmail = $str;
 2118+ $this->invalidateEmail();
21152119 wfRunHooks( 'UserSetEmail', array( $this, &$this->mEmail ) );
21162120 }
21172121

Status & tagging log