Add gender to 'passwordreset-emailerror-capture' message
authorAlexandre Emsenhuber <ialex.wiki@gmail.com>
Fri, 12 Apr 2013 07:47:56 +0000 (09:47 +0200)
committerSiebrand <siebrand@wikimedia.org>
Wed, 17 Apr 2013 19:22:25 +0000 (19:22 +0000)
Bug: 46646
Change-Id: Ib775597d7d5b5afd84717fc7064a73721bc1a01c

includes/specials/SpecialPasswordReset.php
languages/messages/MessagesEn.php

index 6b335c3..a166b56 100644 (file)
@@ -33,6 +33,11 @@ class SpecialPasswordReset extends FormSpecialPage {
         */
        private $email;
 
+       /**
+        * @var User
+        */
+       private $firstUser;
+
        /**
         * @var Status
         */
@@ -257,8 +262,11 @@ class SpecialPasswordReset extends FormSpecialPage {
 
                $this->result = $firstUser->sendMail( $title->escaped(), $this->email->text() );
 
-               // Blank the email if the user is not supposed to see it
-               if( !isset( $data['Capture'] ) || !$data['Capture'] ) {
+               if( isset( $data['Capture'] ) && $data['Capture'] ) {
+                       // Save the user, will be used if an error occurs when sending the email
+                       $this->firstUser = $firstUser;
+               } else {
+                       // Blank the email if the user is not supposed to see it
                        $this->email = null;
                }
 
@@ -281,7 +289,8 @@ class SpecialPasswordReset extends FormSpecialPage {
                        if( $this->result->isGood() ) {
                                $this->getOutput()->addWikiMsg( 'passwordreset-emailsent-capture' );
                        } else {
-                               $this->getOutput()->addWikiMsg( 'passwordreset-emailerror-capture', $this->result->getMessage() );
+                               $this->getOutput()->addWikiMsg( 'passwordreset-emailerror-capture',
+                                       $this->result->getMessage(), $this->firstUser->getName() );
                        }
 
                        $this->getOutput()->addHTML( Html::rawElement( 'pre', array(), $this->email->escaped() ) );
index a38a39a..3648b9f 100644 (file)
@@ -1263,7 +1263,7 @@ password.',
 Temporary password: $2',
 'passwordreset-emailsent'          => 'A password reset email has been sent.',
 'passwordreset-emailsent-capture'  => 'A password reset email has been sent, which is shown below.',
-'passwordreset-emailerror-capture' => 'A password reset email was generated, which is shown below, but sending it to the user failed: $1',
+'passwordreset-emailerror-capture' => 'A password reset email was generated, which is shown below, but sending it to the {{GENDER:$2|user}} failed: $1',
 
 # Special:ChangeEmail
 'changeemail'          => 'Change email address',