X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2Fspecials%2FSpecialPasswordReset.php;h=292b5753960fee2e89048793739ffc23736bd72d;hb=6b758fc982972ee60856af0b766383f3aae97f65;hp=9e72807f0b707b749e0af18ef3f9ff574e478f56;hpb=e9a09648dceb8ed37e90a85ffd7230358878b638;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/specials/SpecialPasswordReset.php b/includes/specials/SpecialPasswordReset.php index 9e72807f0b..292b575396 100644 --- a/includes/specials/SpecialPasswordReset.php +++ b/includes/specials/SpecialPasswordReset.php @@ -42,6 +42,11 @@ class SpecialPasswordReset extends FormSpecialPage { */ private $result; + /** + * @var string $method Identifies which password reset field was specified by the user. + */ + private $method; + public function __construct() { parent::__construct( 'PasswordReset', 'editmyprivateinfo' ); } @@ -58,7 +63,7 @@ class SpecialPasswordReset extends FormSpecialPage { throw new ErrorPageError( 'internalerror', 'resetpass_forbidden' ); } - return parent::checkExecutePermissions( $user ); + parent::checkExecutePermissions( $user ); } protected function getFormFields() { @@ -139,7 +144,7 @@ class SpecialPasswordReset extends FormSpecialPage { * @return bool|array */ public function onSubmit( array $data ) { - global $wgAuth; + global $wgAuth, $wgMinimalPasswordLength; if ( isset( $data['Domain'] ) ) { if ( $wgAuth->validDomain( $data['Domain'] ) ) { @@ -196,6 +201,8 @@ class SpecialPasswordReset extends FormSpecialPage { return array( $error ); } + $this->method = $method; + if ( count( $users ) == 0 ) { if ( $method == 'email' ) { // Don't reveal whether or not an email address is in use @@ -254,7 +261,7 @@ class SpecialPasswordReset extends FormSpecialPage { $passwords = array(); foreach ( $users as $user ) { - $password = $user->randomPassword(); + $password = PasswordFactory::generateRandomPasswordString( $wgMinimalPasswordLength ); $user->setNewpassword( $password ); $user->saveSettings(); $passwords[] = $this->msg( 'passwordreset-emailelement', $user->getName(), $password ) @@ -310,7 +317,12 @@ class SpecialPasswordReset extends FormSpecialPage { $this->getOutput()->addHTML( Html::rawElement( 'pre', array(), $this->email->escaped() ) ); } - $this->getOutput()->addWikiMsg( 'passwordreset-emailsent' ); + if ( $this->method === 'email' ) { + $this->getOutput()->addWikiMsg( 'passwordreset-emailsentemail' ); + } else { + $this->getOutput()->addWikiMsg( 'passwordreset-emailsentusername' ); + } + $this->getOutput()->returnToMain(); }