X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2Fspecials%2FSpecialBotPasswords.php;h=7b2d1bcbfdc5b64c918a0cb7e45a98a9635de76d;hb=b77db9bb430712c2fe40c3b1828397b90fc8dbe8;hp=f76c318e26390576f2f0afdf551a068369a0fe80;hpb=6e62381aaa2e0d0ee572e3827800d05d9a5c67a4;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/specials/SpecialBotPasswords.php b/includes/specials/SpecialBotPasswords.php index f76c318e26..7b2d1bcbfd 100644 --- a/includes/specials/SpecialBotPasswords.php +++ b/includes/specials/SpecialBotPasswords.php @@ -107,6 +107,9 @@ class SpecialBotPasswords extends FormSpecialPage { 'type' => 'check', 'label-message' => 'botpasswords-label-resetpassword', ]; + if ( $this->botPassword->isInvalid() ) { + $fields['resetPassword']['default'] = true; + } } $lang = $this->getLanguage(); @@ -153,22 +156,39 @@ class SpecialBotPasswords extends FormSpecialPage { } else { $linkRenderer = $this->getLinkRenderer(); + $passwordFactory = new PasswordFactory(); + $passwordFactory->init( $this->getConfig() ); + $dbr = BotPassword::getDB( DB_REPLICA ); $res = $dbr->select( 'bot_passwords', - [ 'bp_app_id' ], + [ 'bp_app_id', 'bp_password' ], [ 'bp_user' => $this->userId ], __METHOD__ ); foreach ( $res as $row ) { + try { + $password = $passwordFactory->newFromCiphertext( $row->bp_password ); + $passwordInvalid = $password instanceof InvalidPassword; + unset( $password ); + } catch ( PasswordError $ex ) { + $passwordInvalid = true; + } + + $text = $linkRenderer->makeKnownLink( + $this->getPageTitle( $row->bp_app_id ), + $row->bp_app_id + ); + if ( $passwordInvalid ) { + $text .= $this->msg( 'word-separator' )->escaped() + . $this->msg( 'botpasswords-label-needsreset' )->parse(); + } + $fields[] = [ 'section' => 'existing', 'type' => 'info', 'raw' => true, - 'default' => $linkRenderer->makeKnownLink( - $this->getPageTitle( $row->bp_app_id ), - $row->bp_app_id - ), + 'default' => $text, ]; }