diff options
Diffstat (limited to 'includes/specials/SpecialPasswordReset.php')
-rw-r--r-- | includes/specials/SpecialPasswordReset.php | 26 |
1 files changed, 16 insertions, 10 deletions
diff --git a/includes/specials/SpecialPasswordReset.php b/includes/specials/SpecialPasswordReset.php index efb57657..90b0ac80 100644 --- a/includes/specials/SpecialPasswordReset.php +++ b/includes/specials/SpecialPasswordReset.php @@ -86,7 +86,7 @@ class SpecialPasswordReset extends FormSpecialPage { ); } - if( $this->getUser()->isAllowed( 'passwordreset' ) ){ + if( $this->getUser()->isAllowed( 'passwordreset' ) ) { $a['Capture'] = array( 'type' => 'check', 'label-message' => 'passwordreset-capture', @@ -121,6 +121,8 @@ class SpecialPasswordReset extends FormSpecialPage { * userCanExecute(), and if the data array contains 'Username', etc, then Username * resets are allowed. * @param $data array + * @throws MWException + * @throws ThrottledError|PermissionsError * @return Bool|Array */ public function onSubmit( array $data ) { @@ -134,7 +136,7 @@ class SpecialPasswordReset extends FormSpecialPage { } } - if( isset( $data['Capture'] ) && !$this->getUser()->isAllowed( 'passwordreset' ) ){ + if( isset( $data['Capture'] ) && !$this->getUser()->isAllowed( 'passwordreset' ) ) { // The user knows they don't have the passwordreset permission, but they tried to spoof the form. That's naughty throw new PermissionsError( 'passwordreset' ); } @@ -160,7 +162,7 @@ class SpecialPasswordReset extends FormSpecialPage { ); if ( $res ) { $users = array(); - foreach( $res as $row ){ + foreach( $res as $row ) { $users[] = User::newFromRow( $row ); } } else { @@ -178,8 +180,8 @@ class SpecialPasswordReset extends FormSpecialPage { return array( $error ); } - if( count( $users ) == 0 ){ - if( $method == 'email' ){ + if( count( $users ) == 0 ) { + if( $method == 'email' ) { // Don't reveal whether or not an email address is in use return true; } else { @@ -247,13 +249,13 @@ class SpecialPasswordReset extends FormSpecialPage { $username, $passwordBlock, count( $passwords ), - Title::newMainPage()->getCanonicalUrl(), + '<' . Title::newMainPage()->getCanonicalUrl() . '>', round( $wgNewPasswordExpiry / 86400 ) ); $title = $this->msg( 'passwordreset-emailtitle' ); - $this->result = $firstUser->sendMail( $title->escaped(), $this->email->escaped() ); + $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'] ) { @@ -262,7 +264,7 @@ class SpecialPasswordReset extends FormSpecialPage { if ( $this->result->isGood() ) { return true; - } elseif( isset( $data['Capture'] ) && $data['Capture'] ){ + } elseif( isset( $data['Capture'] ) && $data['Capture'] ) { // The email didn't send, but maybe they knew that and that's why they captured it return true; } else { @@ -273,10 +275,10 @@ class SpecialPasswordReset extends FormSpecialPage { } public function onSuccess() { - if( $this->getUser()->isAllowed( 'passwordreset' ) && $this->email != null ){ + if( $this->getUser()->isAllowed( 'passwordreset' ) && $this->email != null ) { // @todo: Logging - if( $this->result->isGood() ){ + if( $this->result->isGood() ) { $this->getOutput()->addWikiMsg( 'passwordreset-emailsent-capture' ); } else { $this->getOutput()->addWikiMsg( 'passwordreset-emailerror-capture', $this->result->getMessage() ); @@ -324,4 +326,8 @@ class SpecialPasswordReset extends FormSpecialPage { return false; } + + protected function getGroupName() { + return 'users'; + } } |