From: Matthew Flaschen Date: Thu, 18 Feb 2016 03:16:48 +0000 (-0500) Subject: resetUserEmail: Allow resetting email without scrambling password X-Git-Tag: 1.31.0-rc.0~7567^2 X-Git-Url: https://git.cyclocoop.org/%7B%24www_url%7Dadmin/compta/banques/ajouter.php?a=commitdiff_plain;h=5ef414072c78132f393888c39a4689af91ac26fc;p=lhc%2Fweb%2Fwiklou.git resetUserEmail: Allow resetting email without scrambling password There is an mini-script in MediaWiki-Vagrant (set_user_email.erb) that could be replaced by this. Change-Id: Ieb0da6cc358506174f1ff01116d0b286f814b2c7 --- diff --git a/maintenance/resetUserEmail.php b/maintenance/resetUserEmail.php index 816e8a430b..8d0873f1b5 100644 --- a/maintenance/resetUserEmail.php +++ b/maintenance/resetUserEmail.php @@ -34,6 +34,9 @@ class ResetUserEmail extends Maintenance { $this->addDescription( "Resets a user's email" ); $this->addArg( 'user', 'Username or user ID, if starts with #', true ); $this->addArg( 'email', 'Email to assign' ); + + $this->addOption( 'no-reset-password', 'Don\'t reset the user\'s password', false, false ); + parent::__construct(); } @@ -57,8 +60,11 @@ class ResetUserEmail extends Maintenance { $user->setEmail( $email ); $user->setEmailAuthenticationTimestamp( wfTimestampNow() ); $user->saveSettings(); - // Kick whomever is currently controlling the account off - $user->setPassword( PasswordFactory::generateRandomPasswordString( 128 ) ); + + if ( !$this->hasOption( 'no-reset-password' ) ) { + // Kick whomever is currently controlling the account off + $user->setPassword( PasswordFactory::generateRandomPasswordString( 128 ) ); + } } }