From 6dda787ec508411b2c41877e04958f8149b4c0e6 Mon Sep 17 00:00:00 2001 From: jiabao Date: Wed, 1 May 2013 16:05:31 +1000 Subject: [PATCH] Show message when user successfully changed password. 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 | 1 + includes/specials/SpecialChangePassword.php | 23 ++++++++++----------- languages/messages/MessagesEn.php | 3 +-- maintenance/language/messages.inc | 2 +- 4 files changed, 14 insertions(+), 15 deletions(-) diff --git a/RELEASE-NOTES-1.22 b/RELEASE-NOTES-1.22 index e6836da505..b1e88a4b74 100644 --- a/RELEASE-NOTES-1.22 +++ b/RELEASE-NOTES-1.22 @@ -189,6 +189,7 @@ production. * New hook ResetSessionID, called when the session id is reset. * Add a mode parameter to 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 diff --git a/includes/specials/SpecialChangePassword.php b/includes/specials/SpecialChangePassword.php index d297a2fc2c..139bb6d9af 100644 --- a/includes/specials/SpecialChangePassword.php +++ b/includes/specials/SpecialChangePassword.php @@ -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( + "
\n$1\n
", + '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 */ diff --git a/languages/messages/MessagesEn.php b/languages/messages/MessagesEn.php index bfe6bd03ef..7bb3bd20a0 100644 --- a/languages/messages/MessagesEn.php +++ b/languages/messages/MessagesEn.php @@ -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', diff --git a/maintenance/language/messages.inc b/maintenance/language/messages.inc index 5a420912a0..aa8d7cc8e3 100644 --- a/maintenance/language/messages.inc +++ b/maintenance/language/messages.inc @@ -582,7 +582,7 @@ $wgMessageStructure = array( 'newpassword', 'retypenew', 'resetpass_submit', - 'resetpass_success', + 'changepassword-success', 'resetpass_forbidden', 'resetpass-no-info', 'resetpass-submit-loggedin', -- 2.20.1