* (bug 22551) Special:Resetpass now has a "Cancel" button that sends the user to...
authorX! <soxred93@users.mediawiki.org>
Wed, 17 Feb 2010 18:41:05 +0000 (18:41 +0000)
committerX! <soxred93@users.mediawiki.org>
Wed, 17 Feb 2010 18:41:05 +0000 (18:41 +0000)
RELEASE-NOTES
includes/specials/SpecialResetpass.php
languages/messages/MessagesEn.php

index f4e170b..738466e 100644 (file)
@@ -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 ==
 
index 3e49354..967d211 100644 (file)
@@ -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 {
                                "<td></td>\n" .
                                '<td class="mw-input">' .
                                        Xml::submitButton( wfMsg( $submitMsg ) ) .
+                                       Xml::submitButton( wfMsg( 'resetpass-submit-cancel' ), array( 'name' => 'wpCancel' ) ) .
                                "</td>\n" .
                        "</tr>\n" .
                        Xml::closeElement( 'table' ) .
index 69ef11f..c8f0c00 100644 (file)
@@ -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:',