* (bug 32960) remove EmailAuthenticationTimestamp from database when a
authorSam Reed <reedy@users.mediawiki.org>
Sun, 11 Dec 2011 15:31:17 +0000 (15:31 +0000)
committerSam Reed <reedy@users.mediawiki.org>
Sun, 11 Dec 2011 15:31:17 +0000 (15:31 +0000)
  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

RELEASE-NOTES-1.19
includes/Preferences.php
includes/User.php

index a98a6b6..da9ca28 100644 (file)
@@ -176,6 +176,8 @@ production.
 * (bug 31212) History tab not collapsed when the screen is narrow
 * (bug 15521) Use new section summary when the action of adding a new section
   also happens to create the page
+* (bug 32960) remove EmailAuthenticationTimestamp from database when a
+  email address is removed
 
 === API changes in 1.19 ===
 * (bug 19838) siprop=interwikimap can now use the interwiki cache.
index 27603cb..c77e9ea 100644 (file)
@@ -1428,8 +1428,6 @@ class Preferences {
                                # The user has supplied a new email address on the login page
                                # new behaviour: set this new emailaddr from login-page into user database record
                                $user->setEmail( $newaddr );
-                               # But flag as "dirty" = unauthenticated
-                               $user->invalidateEmail();
                                if ( $wgEmailAuthentication ) {
                                        # Mail a temporary password to the dirty address.
                                        # User can come back through the confirmation URL to re-enable email.
@@ -1440,7 +1438,7 @@ class Preferences {
                                        }
                                        $info = 'eauth';
                                }
-                       } else {
+                       } elseif ( $newaddr != $oldaddr ) { // if the address is the same, don't change it
                                $user->setEmail( $newaddr );
                        }
                        if ( $oldaddr != $newaddr ) {
@@ -1474,7 +1472,7 @@ class Preferences {
 class PreferencesForm extends HTMLForm {
        // Override default value from HTMLForm
        protected $mSubSectionBeforeFields = false;
-       
+
        private $modifiedUser;
 
        public function setModifiedUser( $user ) {
@@ -1553,7 +1551,7 @@ class PreferencesForm extends HTMLForm {
        function getBody() {
                return $this->displaySection( $this->mFieldTree, '', 'mw-prefsection-' );
        }
-       
+
        /**
         * Get the <legend> for a given section key. Normally this is the
         * prefs-$key message but we'll allow extensions to override it.
index 53b8fd9..73bae4a 100644 (file)
@@ -2110,7 +2110,11 @@ class User {
         */
        public function setEmail( $str ) {
                $this->load();
+               if( $str == $this->mEmail ) {
+                       return;
+               }
                $this->mEmail = $str;
+               $this->invalidateEmail();
                wfRunHooks( 'UserSetEmail', array( $this, &$this->mEmail ) );
        }