From 5ef414072c78132f393888c39a4689af91ac26fc Mon Sep 17 00:00:00 2001 From: Matthew Flaschen Date: Wed, 17 Feb 2016 22:16:48 -0500 Subject: [PATCH] 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 --- maintenance/resetUserEmail.php | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) 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 ) ); + } } } -- 2.20.1