X-Git-Url: http://git.heureux-cyclage.org/?a=blobdiff_plain;f=maintenance%2FchangePassword.php;h=aa45154dddd43cacfa4fb077cb356047a21883cd;hb=c3cb10b55c832b9dc2d6805d10966549213c46b7;hp=316004bdf0654b530494c4fe3e176d3525c7d44c;hpb=6f7e982df6479e27c3b17f2deda8404ef55f50e6;p=lhc%2Fweb%2Fwiklou.git diff --git a/maintenance/changePassword.php b/maintenance/changePassword.php index 316004bdf0..aa45154ddd 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->getMessage( false, false, 'en' )->text() ); } } }