X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=maintenance%2FchangePassword.php;h=aa45154dddd43cacfa4fb077cb356047a21883cd;hb=82bd6b026ef6ecb7f2fe15acaa40c608680dfff1;hp=d7db3212dc60fc58531f54ca0a74db560934e42b;hpb=d0a8e6b9b30272ec216a8a2ceda3b7fc60db1e7a;p=lhc%2Fweb%2Fwiklou.git diff --git a/maintenance/changePassword.php b/maintenance/changePassword.php index d7db3212dc..aa45154ddd 100644 --- a/maintenance/changePassword.php +++ b/maintenance/changePassword.php @@ -52,22 +52,18 @@ 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() ); } } } -$maintClass = "ChangePassword"; +$maintClass = ChangePassword::class; require_once RUN_MAINTENANCE_IF_MAIN;