Show message when user successfully changed password.
authorjiabao <jiabao.foss@gmail.com>
Wed, 1 May 2013 06:05:31 +0000 (16:05 +1000)
committerAlexandre Emsenhuber <ialex.wiki@gmail.com>
Sun, 18 Aug 2013 09:47:53 +0000 (11:47 +0200)
Return a message when password has been successfully changed.
Give a successbox to the message which is the same as it for
saving preference.

Bug: 47399
Change-Id: I255c53d82cf0a58ee9ff1c0c939854e7392872e5

RELEASE-NOTES-1.22
includes/specials/SpecialChangePassword.php
languages/messages/MessagesEn.php
maintenance/language/messages.inc

index e6836da..b1e88a4 100644 (file)
@@ -189,6 +189,7 @@ production.
 * New hook ResetSessionID, called when the session id is reset.
 * Add a mode parameter to <gallery> tag with potential options of "traditional",
   "nolines", "packed", "packed-overlay", or "packed-hover".
+* (bug 47399) A success message is now displayed after changing the password.
 
 === Bug fixes in 1.22 ===
 * Disable Special:PasswordReset when $wgEnableEmail is false. Previously one
index d297a2f..139bb6d 100644 (file)
@@ -59,7 +59,12 @@ class SpecialChangePassword extends UnlistedSpecialPage {
                }
 
                if ( $request->wasPosted() && $request->getBool( 'wpCancel' ) ) {
-                       $this->doReturnTo();
+                       $titleObj = Title::newFromText( $request->getVal( 'returnto' ) );
+                       if ( !$titleObj instanceof Title ) {
+                               $titleObj = Title::newMainPage();
+                       }
+                       $query = $request->getVal( 'returntoquery' );
+                       $this->getOutput()->redirect( $titleObj->getFullURL( $query ) );
 
                        return;
                }
@@ -79,7 +84,11 @@ class SpecialChangePassword extends UnlistedSpecialPage {
                                $this->attemptReset( $this->mNewpass, $this->mRetype );
 
                                if ( $user->isLoggedIn() ) {
-                                       $this->doReturnTo();
+                                       $this->getOutput()->wrapWikiMsg(
+                                                       "<div class=\"successbox\"><strong>\n$1\n</strong></div>",
+                                                       'changepassword-success'
+                                       );
+                                       $this->getOutput()->returnToMain();
                                } else {
                                        LoginForm::setLoginToken();
                                        $token = LoginForm::getLoginToken();
@@ -103,16 +112,6 @@ class SpecialChangePassword extends UnlistedSpecialPage {
                $this->showForm();
        }
 
-       function doReturnTo() {
-               $request = $this->getRequest();
-               $titleObj = Title::newFromText( $request->getVal( 'returnto' ) );
-               if ( !$titleObj instanceof Title ) {
-                       $titleObj = Title::newMainPage();
-               }
-               $query = $request->getVal( 'returntoquery' );
-               $this->getOutput()->redirect( $titleObj->getFullURL( $query ) );
-       }
-
        /**
         * @param $msg string
         */
index bfe6bd0..7bb3bd2 100644 (file)
@@ -1277,8 +1277,7 @@ To finish logging in, you must set a new password here:',
 'newpassword'               => 'New password:',
 'retypenew'                 => 'Retype new password:',
 'resetpass_submit'          => 'Set password and log in',
-'resetpass_success'         => 'Your password has been changed successfully!
-Now logging you in...',
+'changepassword-success'    => 'Your password has been changed successfully!',
 'resetpass_forbidden'       => 'Passwords cannot be changed',
 'resetpass-no-info'         => 'You must be logged in to access this page directly.',
 'resetpass-submit-loggedin' => 'Change password',
index 5a42091..aa8d7cc 100644 (file)
@@ -582,7 +582,7 @@ $wgMessageStructure = array(
                'newpassword',
                'retypenew',
                'resetpass_submit',
-               'resetpass_success',
+               'changepassword-success',
                'resetpass_forbidden',
                'resetpass-no-info',
                'resetpass-submit-loggedin',