From: X! Date: Wed, 17 Feb 2010 18:41:05 +0000 (+0000) Subject: * (bug 22551) Special:Resetpass now has a "Cancel" button that sends the user to... X-Git-Tag: 1.31.0-rc.0~37713 X-Git-Url: http://git.cyclocoop.org/%40spipnet%40?a=commitdiff_plain;h=a177c174718d4133aea62d2f519ebdf32e4fdca5;p=lhc%2Fweb%2Fwiklou.git * (bug 22551) Special:Resetpass now has a "Cancel" button that sends the user to the page set in the &returnto parameter. --- diff --git a/RELEASE-NOTES b/RELEASE-NOTES index f4e170b204..738466e2f4 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -763,6 +763,8 @@ comment from another wiki. * Truncate summary of page moves in revision comment field to avoid broken multibyte characters * (bug 22540) ForeignApiRepos no longer try to store thumbnails that don't exist +* (bug 22551) Special:Resetpass now has a "Cancel" button that sends the user to + the page set in the &returnto parameter. == API changes in 1.16 == diff --git a/includes/specials/SpecialResetpass.php b/includes/specials/SpecialResetpass.php index 3e49354488..967d2119b1 100644 --- a/includes/specials/SpecialResetpass.php +++ b/includes/specials/SpecialResetpass.php @@ -37,6 +37,11 @@ class SpecialResetpass extends SpecialPage { return; } + if( $wgRequest->wasPosted() && $wgRequest->getBool( 'wpCancel' ) ) { + $this->doReturnTo(); + return; + } + if( $wgRequest->wasPosted() && $wgUser->matchEditToken( $wgRequest->getVal('token') ) ) { try { $this->attemptReset( $this->mNewpass, $this->mRetype ); @@ -54,17 +59,22 @@ class SpecialResetpass extends SpecialPage { $login = new LoginForm( new FauxRequest( $data, true ) ); $login->execute(); } - $titleObj = Title::newFromText( $wgRequest->getVal( 'returnto' ) ); - if ( !$titleObj instanceof Title ) { - $titleObj = Title::newMainPage(); - } - $wgOut->redirect( $titleObj->getFullURL() ); + $this->doReturnTo(); } catch( PasswordError $e ) { $this->error( $e->getMessage() ); } } $this->showForm(); } + + function doReturnTo() { + global $wgRequest, $wgOut; + $titleObj = Title::newFromText( $wgRequest->getVal( 'returnto' ) ); + if ( !$titleObj instanceof Title ) { + $titleObj = Title::newMainPage(); + } + $wgOut->redirect( $titleObj->getFullURL() ); + } function error( $msg ) { global $wgOut; @@ -119,6 +129,7 @@ class SpecialResetpass extends SpecialPage { "\n" . '' . Xml::submitButton( wfMsg( $submitMsg ) ) . + Xml::submitButton( wfMsg( 'resetpass-submit-cancel' ), array( 'name' => 'wpCancel' ) ) . "\n" . "\n" . Xml::closeElement( 'table' ) . diff --git a/languages/messages/MessagesEn.php b/languages/messages/MessagesEn.php index 69ef11fe8e..c8f0c006eb 100644 --- a/languages/messages/MessagesEn.php +++ b/languages/messages/MessagesEn.php @@ -1153,6 +1153,7 @@ Now logging you in...', 'resetpass_forbidden' => 'Passwords cannot be changed', 'resetpass-no-info' => 'You must be logged in to access this page directly.', 'resetpass-submit-loggedin' => 'Change password', +'resetpass-submit-cancel' => 'Cancel', 'resetpass-wrong-oldpass' => 'Invalid temporary or current password. You may have already successfully changed your password or requested a new temporary password.', 'resetpass-temp-password' => 'Temporary password:',