IAlex has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/58861


Change subject: (bug 46646) Add gender to 'passwordreset-emailerror-capture' 
message
......................................................................

(bug 46646) Add gender to 'passwordreset-emailerror-capture' message

bug: 46646
Change-Id: Ib775597d7d5b5afd84717fc7064a73721bc1a01c
---
M includes/specials/SpecialPasswordReset.php
M languages/messages/MessagesEn.php
2 files changed, 13 insertions(+), 4 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/61/58861/1

diff --git a/includes/specials/SpecialPasswordReset.php 
b/includes/specials/SpecialPasswordReset.php
index 6b335c3..a166b56 100644
--- a/includes/specials/SpecialPasswordReset.php
+++ b/includes/specials/SpecialPasswordReset.php
@@ -34,6 +34,11 @@
        private $email;
 
        /**
+        * @var User
+        */
+       private $firstUser;
+
+       /**
         * @var Status
         */
        private $result;
@@ -257,8 +262,11 @@
 
                $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 @@
                        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() ) );
diff --git a/languages/messages/MessagesEn.php 
b/languages/messages/MessagesEn.php
index a38a39a..3648b9f 100644
--- a/languages/messages/MessagesEn.php
+++ b/languages/messages/MessagesEn.php
@@ -1263,7 +1263,7 @@
 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',

-- 
To view, visit https://gerrit.wikimedia.org/r/58861
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ib775597d7d5b5afd84717fc7064a73721bc1a01c
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: IAlex <coderev...@emsenhuber.ch>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to