X-Git-Url: http://git.cyclocoop.org/?a=blobdiff_plain;f=includes%2Fspecials%2FSpecialChangePassword.php;h=f87aa0e8da6f19163eadabb08408a3ced6877b20;hb=8148f72d4cfebb1cdef2783dc96220cf7bdbc0ae;hp=7d7f7378b7c61240534cf5ebf5afd616831446b8;hpb=1a80d46370027b144ed243483186fe069826d973;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/specials/SpecialChangePassword.php b/includes/specials/SpecialChangePassword.php index 7d7f7378b7..f87aa0e8da 100644 --- a/includes/specials/SpecialChangePassword.php +++ b/includes/specials/SpecialChangePassword.php @@ -26,7 +26,7 @@ * * @ingroup SpecialPage */ -class SpecialChangePassword extends SpecialPage { +class SpecialChangePassword extends UnlistedSpecialPage { public function __construct() { parent::__construct( 'ChangePassword' ); } @@ -35,35 +35,39 @@ class SpecialChangePassword extends SpecialPage { * Main execution point */ function execute( $par ) { - global $wgUser, $wgAuth, $wgOut, $wgRequest; + global $wgAuth; if ( wfReadOnly() ) { - $wgOut->readOnlyPage(); - return; + throw new ReadOnlyError; } - $this->mUserName = $wgRequest->getVal( 'wpName' ); - $this->mOldpass = $wgRequest->getVal( 'wpPassword' ); - $this->mNewpass = $wgRequest->getVal( 'wpNewPassword' ); - $this->mRetype = $wgRequest->getVal( 'wpRetype' ); - $this->mDomain = $wgRequest->getVal( 'wpDomain' ); + $request = $this->getRequest(); + $this->mUserName = trim( $request->getVal( 'wpName' ) ); + $this->mOldpass = $request->getVal( 'wpPassword' ); + $this->mNewpass = $request->getVal( 'wpNewPassword' ); + $this->mRetype = $request->getVal( 'wpRetype' ); + $this->mDomain = $request->getVal( 'wpDomain' ); $this->setHeaders(); $this->outputHeader(); - $wgOut->disallowUserJs(); + $this->getOutput()->disallowUserJs(); - if( !$wgRequest->wasPosted() && !$wgUser->isLoggedIn() ) { + $user = $this->getUser(); + if( !$request->wasPosted() && !$user->isLoggedIn() ) { $this->error( wfMsg( 'resetpass-no-info' ) ); return; } - if( $wgRequest->wasPosted() && $wgRequest->getBool( 'wpCancel' ) ) { + if( $request->wasPosted() && $request->getBool( 'wpCancel' ) ) { $this->doReturnTo(); return; } - if( $wgRequest->wasPosted() && $wgUser->matchEditToken( $wgRequest->getVal( 'token' ) ) ) { + if( $request->wasPosted() && $user->matchEditToken( $request->getVal( 'token' ) ) ) { try { + if ( isset( $_SESSION['wsDomain'] ) ) { + $this->mDomain = $_SESSION['wsDomain']; + } $wgAuth->setDomain( $this->mDomain ); if( !$wgAuth->allowPasswordChange() ) { $this->error( wfMsg( 'resetpass_forbidden' ) ); @@ -71,8 +75,8 @@ class SpecialChangePassword extends SpecialPage { } $this->attemptReset( $this->mNewpass, $this->mRetype ); - $wgOut->addWikiMsg( 'resetpass_success' ); - if( !$wgUser->isLoggedIn() ) { + $this->getOutput()->addWikiMsg( 'resetpass_success' ); + if( !$user->isLoggedIn() ) { LoginForm::setLoginToken(); $token = LoginForm::getLoginToken(); $data = array( @@ -81,9 +85,9 @@ class SpecialChangePassword extends SpecialPage { 'wpDomain' => $this->mDomain, 'wpLoginToken' => $token, 'wpPassword' => $this->mNewpass, - 'returnto' => $wgRequest->getVal( 'returnto' ), + 'returnto' => $request->getVal( 'returnto' ), ); - if( $wgRequest->getCheck( 'wpRemember' ) ) { + if( $request->getCheck( 'wpRemember' ) ) { $data['wpRemember'] = 1; } $login = new LoginForm( new FauxRequest( $data, true ) ); @@ -98,36 +102,33 @@ class SpecialChangePassword extends SpecialPage { } function doReturnTo() { - global $wgRequest, $wgOut; - $titleObj = Title::newFromText( $wgRequest->getVal( 'returnto' ) ); + $titleObj = Title::newFromText( $this->getRequest()->getVal( 'returnto' ) ); if ( !$titleObj instanceof Title ) { $titleObj = Title::newMainPage(); } - $wgOut->redirect( $titleObj->getFullURL() ); + $this->getOutput()->redirect( $titleObj->getFullURL() ); } function error( $msg ) { - global $wgOut; - $wgOut->addHTML( Xml::element('p', array( 'class' => 'error' ), $msg ) ); + $this->getOutput()->addHTML( Xml::element('p', array( 'class' => 'error' ), $msg ) ); } function showForm() { - global $wgOut, $wgUser, $wgRequest; + global $wgCookieExpiration; - $self = $this->getTitle(); + $user = $this->getUser(); if ( !$this->mUserName ) { - $this->mUserName = $wgUser->getName(); + $this->mUserName = $user->getName(); } $rememberMe = ''; - if ( !$wgUser->isLoggedIn() ) { - global $wgCookieExpiration, $wgLang; + if ( !$user->isLoggedIn() ) { $rememberMe = '