Merge "mw.Upload.BookletLayout: Don't explode when the API call fails with 'exception'"
[lhc/web/wiklou.git] / includes / specials / SpecialPasswordReset.php
index 53e1d1b..21ce1e1 100644 (file)
@@ -42,10 +42,19 @@ 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' );
        }
 
+       public function doesWrites() {
+               return true;
+       }
+
        public function userCanExecute( User $user ) {
                return $this->canChangePassword( $user ) === true && parent::userCanExecute( $user );
        }
@@ -196,6 +205,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
@@ -310,7 +321,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();
        }