Anomie has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/250025

Change subject: Avoid calling User::setPassword() on users not in database
......................................................................

Avoid calling User::setPassword() on users not in database

MediaWiki core change Id3d4074 is removing the ability to call
$user->setPassword() before the user is added to the database. This change
updates the extension to avoid such calls. It remains backwards-compatible with
older versions of MediaWiki through adding a saveSettings() call when
necessary.

Change-Id: I29ca884729a48bfb5b335dbcb04353fae8134dcd
---
M includes/WebPlatformAuthHooks.php
1 file changed, 2 insertions(+), 2 deletions(-)


  git pull 
ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/WebPlatformAuth 
refs/changes/25/250025/1

diff --git a/includes/WebPlatformAuthHooks.php 
b/includes/WebPlatformAuthHooks.php
index dcec798..8b6769c 100644
--- a/includes/WebPlatformAuthHooks.php
+++ b/includes/WebPlatformAuthHooks.php
@@ -211,10 +211,10 @@
         // No user exists whatsoever, create and make current user
         $tempUser->ConfirmEmail();
         $tempUser->setEmailAuthenticationTimestamp( time() );
-        $tempUser->setPassword( User::randomPassword() );
         $tempUser->setToken();
         $tempUser->setOption( "rememberpassword" , 0 );
         $tempUser->addToDatabase();
+        $tempUser->setPassword( User::randomPassword() );
         $GLOBALS['poorman_logging'][] = sprintf( 'User %s created' , 
$tempUser->getName() ) ;
       } else {
         // User exist in database, load it
@@ -343,10 +343,10 @@
           // No user exists whatsoever, create and make current user
           $tempUser->ConfirmEmail();
           $tempUser->setEmailAuthenticationTimestamp( time() );
-          $tempUser->setPassword( User::randomPassword() );
           $tempUser->setToken();
           $tempUser->setOption( "rememberpassword" , 0 );
           $tempUser->addToDatabase();
+          $tempUser->setPassword( User::randomPassword() );
           $GLOBALS['poorman_logging'][] = sprintf( 'User %s created' , 
$tempUser->getName() ) ;
         } else {
           // User exist in database, load it

-- 
To view, visit https://gerrit.wikimedia.org/r/250025
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I29ca884729a48bfb5b335dbcb04353fae8134dcd
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/WebPlatformAuth
Gerrit-Branch: master
Gerrit-Owner: Anomie <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to