X-Git-Url: https://git.cyclocoop.org/%7B%7B%20url_for%28?a=blobdiff_plain;f=maintenance%2FcreateAndPromote.php;h=3591b9ce2456f0728c3c058571e88120c2b327d3;hb=79806e91e7512ae0122be81e3c84721f5d4f09e1;hp=848c2f7eda0654ccd4684bb41b8260dd74c4fa89;hpb=cc28eaeb0930c2d876ee6205de035a12e142d38f;p=lhc%2Fweb%2Fwiklou.git diff --git a/maintenance/createAndPromote.php b/maintenance/createAndPromote.php index 848c2f7eda..3591b9ce24 100644 --- a/maintenance/createAndPromote.php +++ b/maintenance/createAndPromote.php @@ -56,6 +56,8 @@ class CreateAndPromote extends Maintenance { } public function execute() { + global $wgDisableAuthManager; + $username = $this->getArg( 0 ); $password = $this->getArg( 1 ); $force = $this->hasOption( 'force' ); @@ -120,7 +122,18 @@ class CreateAndPromote extends Maintenance { if ( $password ) { # Try to set the password try { - $user->setPassword( $password ); + 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' ) ); + } + } if ( $exists ) { $this->output( "Password set.\n" ); $user->saveSettings();