From: Alexandre Emsenhuber Date: Fri, 12 Apr 2013 07:47:56 +0000 (+0200) Subject: Add gender to 'passwordreset-emailerror-capture' message X-Git-Tag: 1.31.0-rc.0~19975^2 X-Git-Url: http://git.cyclocoop.org/%7B%24www_url%7Dadmin/password.php?a=commitdiff_plain;h=644f62b54ab2ddad70e0092437bcaba89f344978;p=lhc%2Fweb%2Fwiklou.git Add gender to 'passwordreset-emailerror-capture' message Bug: 46646 Change-Id: Ib775597d7d5b5afd84717fc7064a73721bc1a01c --- 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',