X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2Fspecials%2FSpecialBotPasswords.php;h=1dd78d7cfcbd0f9fec6f4abd900517b243cb0a4e;hb=c2602eaed5c726e1b78cc9ecb55a94392e923642;hp=61ab642c5351caf49b652cf90b72de3ae7d3c63f;hpb=196db3429307c04e5c92f6c06a965a394d4a8a87;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/specials/SpecialBotPasswords.php b/includes/specials/SpecialBotPasswords.php index 61ab642c53..1dd78d7cfc 100644 --- a/includes/specials/SpecialBotPasswords.php +++ b/includes/specials/SpecialBotPasswords.php @@ -146,19 +146,9 @@ class SpecialBotPasswords extends FormSpecialPage { ]; $fields['restrictions'] = [ - 'type' => 'textarea', - 'label-message' => 'botpasswords-label-restrictions', + 'class' => 'HTMLRestrictionsField', 'required' => true, - 'default' => $this->botPassword->getRestrictions()->toJson( true ), - 'rows' => 5, - 'validation-callback' => function ( $v ) { - try { - MWRestrictions::newFromJson( $v ); - return true; - } catch ( InvalidArgumentException $ex ) { - return $ex->getMessage(); - } - }, + 'default' => $this->botPassword->getRestrictions(), ]; } else { @@ -234,7 +224,7 @@ class SpecialBotPasswords extends FormSpecialPage { 'name' => 'op', 'value' => 'create', 'label-message' => 'botpasswords-label-create', - 'flags' => [ 'primary', 'constructive' ], + 'flags' => [ 'primary', 'progressive' ], ] ); } @@ -282,7 +272,7 @@ class SpecialBotPasswords extends FormSpecialPage { $bp = BotPassword::newUnsaved( [ 'centralId' => $this->userId, 'appId' => $this->par, - 'restrictions' => MWRestrictions::newFromJson( $data['restrictions'] ), + 'restrictions' => $data['restrictions'], 'grants' => array_merge( MWGrants::getHiddenGrants(), preg_replace( '/^grant-/', '', $data['grants'] ) @@ -290,9 +280,7 @@ class SpecialBotPasswords extends FormSpecialPage { ] ); if ( $this->operation === 'insert' || !empty( $data['resetPassword'] ) ) { - $this->password = PasswordFactory::generateRandomPasswordString( - max( 32, $this->getConfig()->get( 'MinimalPasswordLength' ) ) - ); + $this->password = BotPassword::generatePassword( $this->getConfig() ); $passwordFactory = new PasswordFactory(); $passwordFactory->init( RequestContext::getMain()->getConfig() ); $password = $passwordFactory->newFromPlaintext( $this->password ); @@ -335,7 +323,9 @@ class SpecialBotPasswords extends FormSpecialPage { $out->addWikiMsg( 'botpasswords-newpassword', htmlspecialchars( $username . $sep . $this->par ), - htmlspecialchars( $this->password ) + htmlspecialchars( $this->password ), + htmlspecialchars( $username ), + htmlspecialchars( $this->par . $sep . $this->password ) ); $this->password = null; }