X-Git-Url: http://git.heureux-cyclage.org/?a=blobdiff_plain;f=maintenance%2FchangePassword.php;h=aa45154dddd43cacfa4fb077cb356047a21883cd;hb=d60849c5de08db4cf027325f17f1a3705e106b5d;hp=d7db3212dc60fc58531f54ca0a74db560934e42b;hpb=34e956016bb9189af091569946257e5b9b138585;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;