From 644f62b54ab2ddad70e0092437bcaba89f344978 Mon Sep 17 00:00:00 2001 From: Alexandre Emsenhuber Date: Fri, 12 Apr 2013 09:47:56 +0200 Subject: [PATCH] Add gender to 'passwordreset-emailerror-capture' message Bug: 46646 Change-Id: Ib775597d7d5b5afd84717fc7064a73721bc1a01c --- includes/specials/SpecialPasswordReset.php | 15 ++++++++++++--- languages/messages/MessagesEn.php | 2 +- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/includes/specials/SpecialPasswordReset.php b/includes/specials/SpecialPasswordReset.php index 6b335c32d2..a166b56b69 100644 --- a/includes/specials/SpecialPasswordReset.php +++ b/includes/specials/SpecialPasswordReset.php @@ -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() ) ); diff --git a/languages/messages/MessagesEn.php b/languages/messages/MessagesEn.php index a38a39aefb..3648b9fef8 100644 --- a/languages/messages/MessagesEn.php +++ b/languages/messages/MessagesEn.php @@ -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', -- 2.20.1