X-Git-Url: http://git.cyclocoop.org/%22%20.%20generer_url_aide%28?a=blobdiff_plain;f=maintenance%2FchangePassword.php;h=d7db3212dc60fc58531f54ca0a74db560934e42b;hb=2c2dc593d25f652c04185e597b7f9de2c22c2e31;hp=a550d12777431c7d342d6ffde3bc277c03585289;hpb=ff13c3d92a3357d2cbb03c4d58dfc33999942b0a;p=lhc%2Fweb%2Fwiklou.git diff --git a/maintenance/changePassword.php b/maintenance/changePassword.php index a550d12777..d7db3212dc 100644 --- a/maintenance/changePassword.php +++ b/maintenance/changePassword.php @@ -41,36 +41,30 @@ class ChangePassword extends Maintenance { } public function execute() { - global $wgDisableAuthManager; - if ( $this->hasOption( "user" ) ) { $user = User::newFromName( $this->getOption( 'user' ) ); } elseif ( $this->hasOption( "userid" ) ) { $user = User::newFromId( $this->getOption( 'userid' ) ); } else { - $this->error( "A \"user\" or \"userid\" must be set to change the password for", true ); + $this->fatalError( "A \"user\" or \"userid\" must be set to change the password for" ); } if ( !$user || !$user->getId() ) { - $this->error( "No such user: " . $this->getOption( 'user' ), true ); + $this->fatalError( "No such user: " . $this->getOption( 'user' ) ); } $password = $this->getOption( 'password' ); try { - if ( $wgDisableAuthManager ) { - $user->setPassword( $password ); - } else { - $status = $user->changeAuthenticationData( [ - 'username' => $user->getName(), - 'password' => $password, - 'retype' => $password, - ] ); - if ( !$status->isGood() ) { - throw new PasswordError( $status->getWikiText( null, null, 'en' ) ); - } + $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 ) { - $this->error( $pwe->getText(), true ); + $this->fatalError( $pwe->getText() ); } } }