X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=maintenance%2FchangePassword.php;h=9fa66324f5a1ef3f6a507f21fef7d159894e6de8;hb=052c6c9aedfce9b5470f5709da14268bc7c8bc38;hp=8687f81410c5673f065eb3b5d99419ea7eb4360d;hpb=fc1ca75323b5f424a9f8d28d42d85a311ed2f721;p=lhc%2Fweb%2Fwiklou.git diff --git a/maintenance/changePassword.php b/maintenance/changePassword.php index 8687f81410..9fa66324f5 100644 --- a/maintenance/changePassword.php +++ b/maintenance/changePassword.php @@ -51,8 +51,16 @@ class ChangePassword extends Maintenance { if ( !$user || !$user->getId() ) { $this->error( "No such user: " . $this->getOption( 'user' ), true ); } + $password = $this->getOption( 'password' ); try { - $user->setPassword( $this->getOption( 'password' ) ); + $status = $user->changeAuthenticationData( [ + 'username' => $user->getName(), + 'password' => $password, + 'retype' => $password, + ] ); + if ( !$status->isGood() ) { + throw new PasswordError( $status->getWikiText( null, null, 'en' ) ); + } $user->saveSettings(); $this->output( "Password set for " . $user->getName() . "\n" ); } catch ( PasswordError $pwe ) {