}
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;
}
$this->attemptReset( $this->mNewpass, $this->mRetype );
if ( $user->isLoggedIn() ) {
- $this->doReturnTo();
+ $this->getOutput()->wrapWikiMsg(
+ "<div class=\"successbox\">\n$1\n</div>",
+ 'changepassword-success'
+ );
+ $this->getOutput()->returnToMain();
} else {
LoginForm::setLoginToken();
$token = LoginForm::getLoginToken();
$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
*/
* @throws PasswordError when cannot set the new password because requirements not met.
*/
protected function attemptReset( $newpass, $retype ) {
+ global $wgPasswordAttemptThrottle;
+
$isSelf = ( $this->mUserName === $this->getUser()->getName() );
if ( $isSelf ) {
$user = $this->getUser();
$throttleCount = LoginForm::incLoginThrottle( $this->mUserName );
if ( $throttleCount === true ) {
- throw new PasswordError( $this->msg( 'login-throttled' )->text() );
+ $lang = $this->getLanguage();
+ throw new PasswordError( $this->msg( 'login-throttled' )
+ ->params( $lang->formatDuration( $wgPasswordAttemptThrottle['seconds'] ) )
+ ->text()
+ );
}
$abortMsg = 'resetpass-abort-generic';