X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=maintenance%2FchangePassword.php;h=e7df448f7a0cfa83bd67a05d03bfc4fe01373853;hb=0465a6dd04f7f96a6efffa0a35888fe78eab0d92;hp=316004bdf0654b530494c4fe3e176d3525c7d44c;hpb=236488d398046838059f758b0915341648b64c7b;p=lhc%2Fweb%2Fwiklou.git 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' ) ); } } }