* @ingroup SpecialPage
*/
class SpecialChangePassword extends UnlistedSpecialPage {
+
+ protected $mUserName, $mOldpass, $mNewpass, $mRetype, $mDomain;
+
public function __construct() {
parent::__construct( 'ChangePassword' );
}
function execute( $par ) {
global $wgAuth;
- $this->checkReadOnly();
+ $this->setHeaders();
+ $this->outputHeader();
+ $this->getOutput()->disallowUserJs();
$request = $this->getRequest();
$this->mUserName = trim( $request->getVal( 'wpName' ) );
$this->mRetype = $request->getVal( 'wpRetype' );
$this->mDomain = $request->getVal( 'wpDomain' );
- $this->setHeaders();
- $this->outputHeader();
- $this->getOutput()->disallowUserJs();
-
$user = $this->getUser();
if( !$request->wasPosted() && !$user->isLoggedIn() ) {
$this->error( $this->msg( 'resetpass-no-info' )->text() );
return;
}
+ $this->checkReadOnly();
+
if( $request->wasPosted() && $user->matchEditToken( $request->getVal( 'token' ) ) ) {
try {
- if ( isset( $_SESSION['wsDomain'] ) ) {
- $this->mDomain = $_SESSION['wsDomain'];
- }
- $wgAuth->setDomain( $this->mDomain );
+ $this->mDomain = $wgAuth->getDomain();
if( !$wgAuth->allowPasswordChange() ) {
$this->error( $this->msg( 'resetpass_forbidden' )->text() );
return;
$this->getOutput()->redirect( $titleObj->getFullURL() );
}
+ /**
+ * @param $msg string
+ */
function error( $msg ) {
$this->getOutput()->addHTML( Xml::element('p', array( 'class' => 'error' ), $msg ) );
}
);
}
+ /**
+ * @param $fields array
+ * @return string
+ */
function pretty( $fields ) {
$out = '';
foreach ( $fields as $list ) {
try {
$user->setPassword( $this->mNewpass );
wfRunHooks( 'PrefsPasswordAudit', array( $user, $newpass, 'success' ) );
- $this->mNewpass = $this->mOldpass = $this->mRetypePass = '';
+ $this->mNewpass = $this->mOldpass = $this->mRetype = '';
} catch( PasswordError $e ) {
wfRunHooks( 'PrefsPasswordAudit', array( $user, $newpass, 'error' ) );
throw new PasswordError( $e->getMessage() );