r32243 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r32242‎ | r32243 | r32244 >
Date:18:54, 20 March 2008
Author:rotem
Status:old
Tags:
Comment:
Make CentralAuthPlugin::updateUser work properly: do save changes (were not saved on login); update e-mail authentication timestamp; only update attached accounts.
Modified paths:
  • /trunk/extensions/CentralAuth/CentralAuthPlugin.php (modified) (history)
  • /trunk/extensions/CentralAuth/CentralAuthUser.php (modified) (history)

Diff [purge]

Index: trunk/extensions/CentralAuth/CentralAuthPlugin.php
@@ -108,9 +108,10 @@
109109 */
110110 function updateUser( &$user ) {
111111 $central = new CentralAuthUser( $user->getName() );
112 - $email = $central->getEmail();
113 - if ( strval( $email ) !== '' ) {
114 - $user->setEmail( $email );
 112+ if ( $central->exists() && $central->isAttached() ) {
 113+ $user->setEmail( $central->getEmail() );
 114+ $user->mEmailAuthenticated = $central->getEmailAuthenticationTimestamp();
 115+ $user->saveSettings();
115116 }
116117 return true;
117118 }
Index: trunk/extensions/CentralAuth/CentralAuthUser.php
@@ -1045,6 +1045,14 @@
10461046 __METHOD__ );
10471047 }
10481048
 1049+ function getEmailAuthenticationTimestamp() {
 1050+ $dbr = self::getCentralDB();
 1051+ return $dbr->selectField( self::tableName( 'globaluser' ),
 1052+ 'gu_email_authenticated',
 1053+ array( 'gu_id' => $this->getId() ),
 1054+ __METHOD__ );
 1055+ }
 1056+
10491057 /**
10501058 * Salt and hash a new plaintext password.
10511059 * @param string $password plaintext

Status & tagging log