From: jenkins-bot Date: Sat, 1 Jun 2019 00:35:12 +0000 (+0000) Subject: Merge "Improve changePassword.php error handling" X-Git-Tag: 1.34.0-rc.0~1545 X-Git-Url: https://git.heureux-cyclage.org/?p=lhc%2Fweb%2Fwiklou.git;a=commitdiff_plain;h=af7ae6c804be8629fe2305e3a088f03e1af2fa9b;hp=dab1a413253a1fb97fd252f5e0f983c33d34e8a3 Merge "Improve changePassword.php error handling" --- diff --git a/maintenance/changePassword.php b/maintenance/changePassword.php index 316004bdf0..e7df448f7a 100644 --- a/maintenance/changePassword.php +++ b/maintenance/changePassword.php @@ -52,19 +52,15 @@ class ChangePassword extends Maintenance { $this->fatalError( "No such user: " . $this->getOption( 'user' ) ); } $password = $this->getOption( 'password' ); - try { - $status = $user->changeAuthenticationData( [ - 'username' => $user->getName(), - 'password' => $password, - 'retype' => $password, - ] ); - if ( !$status->isGood() ) { - throw new PasswordError( $status->getWikiText( null, null, 'en' ) ); - } - $user->saveSettings(); + $status = $user->changeAuthenticationData( [ + 'username' => $user->getName(), + 'password' => $password, + 'retype' => $password, + ] ); + if ( $status->isGood() ) { $this->output( "Password set for " . $user->getName() . "\n" ); - } catch ( PasswordError $pwe ) { - $this->fatalError( $pwe->getText() ); + } else { + $this->fatalError( $status->getWikiText( null, null, 'en' ) ); } } }