/**
  * Main execution point
  */
 function execute($par = '')
 {
     global $wgUser, $wgAuth, $wgOut, $wgRequest;
     if (!$wgAuth->allowPasswordChange()) {
         $this->error(wfMsg('resetpass_forbidden'));
         return;
     }
     if ($this->mName === null && !$wgRequest->wasPosted()) {
         $this->error(wfMsg('resetpass_missing'));
         return;
     }
     if ($wgRequest->wasPosted() && $wgUser->matchEditToken($wgRequest->getVal('token'))) {
         $newpass = $wgRequest->getVal('wpNewPassword');
         $retype = $wgRequest->getVal('wpRetype');
         try {
             $this->attemptReset($newpass, $retype);
             $wgOut->addWikiText(wfMsg('resetpass_success'));
             $data = array('action' => 'submitlogin', 'wpName' => $this->mName, 'wpPassword' => $newpass, 'returnto' => $wgRequest->getVal('returnto'));
             if ($wgRequest->getCheck('wpRemember')) {
                 $data['wpRemember'] = 1;
             }
             $login = new LoginForm(new FauxRequest($data, true));
             $login->execute();
             return;
         } catch (PasswordError $e) {
             $this->error($e->getMessage());
         }
     }
     $this->showForm();
 }
示例#2
0
/**
 * constructor
 */
function wfSpecialUserlogin($par = '')
{
    global $wgRequest;
    if (session_id() == '') {
        wfSetupSession();
    }
    $form = new LoginForm($wgRequest, $par);
    $form->execute();
}
示例#3
0
/**
 * constructor
 */
function wfSpecialUserlogin()
{
    global $wgCommandLineMode;
    global $wgRequest;
    if (!$wgCommandLineMode && !isset($_COOKIE[session_name()])) {
        wfSetupSession();
    }
    $form = new LoginForm($wgRequest);
    $form->execute();
}
示例#4
0
/**
 * constructor
 */
function wfSpecialUserlogin($par = '')
{
    global $wgRequest, $wgHooks;
    if (session_id() == '') {
        wfSetupSession();
    }
    $form = new LoginForm($wgRequest, $par);
    $form->execute();
    $wgHooks['BeforeTabsLine'][] = array('LoginForm::topContent', $form);
}
 /**
  * Main execution point
  */
 function execute($par)
 {
     global $wgAuth;
     $this->checkReadOnly();
     $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();
     $this->getOutput()->disallowUserJs();
     $user = $this->getUser();
     if (!$request->wasPosted() && !$user->isLoggedIn()) {
         $this->error($this->msg('resetpass-no-info')->text());
         return;
     }
     if ($request->wasPosted() && $request->getBool('wpCancel')) {
         $this->doReturnTo();
         return;
     }
     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($this->msg('resetpass_forbidden')->text());
                 return;
             }
             $this->attemptReset($this->mNewpass, $this->mRetype);
             $this->getOutput()->addWikiMsg('resetpass_success');
             if (!$user->isLoggedIn()) {
                 LoginForm::setLoginToken();
                 $token = LoginForm::getLoginToken();
                 $data = array('action' => 'submitlogin', 'wpName' => $this->mUserName, 'wpDomain' => $this->mDomain, 'wpLoginToken' => $token, 'wpPassword' => $this->mNewpass, 'returnto' => $request->getVal('returnto'));
                 if ($request->getCheck('wpRemember')) {
                     $data['wpRemember'] = 1;
                 }
                 $login = new LoginForm(new FauxRequest($data, true));
                 $login->setContext($this->getContext());
                 $login->execute(null);
             }
             $this->doReturnTo();
         } catch (PasswordError $e) {
             $this->error($e->getMessage());
         }
     }
     $this->showForm();
 }
/**
 * constructor
 */
function wfSpecialUserlogin()
{
    global $wgCommandLineMode;
    global $wgRequest;
    global $wgAutoLogin, $wgOut;
    if (!$wgAutoLogin) {
        if (!$wgCommandLineMode && !isset($_COOKIE[session_name()])) {
            User::SetupSession();
        }
        $form = new LoginForm($wgRequest);
        $form->execute();
    } else {
        $wgOut->addHTML(wfMsg('disabled_on_this_wiki'));
        $wgOut->returntoMain();
    }
}
示例#7
0
 /**
  * Main execution point
  */
 function execute($par)
 {
     global $wgUser, $wgAuth, $wgOut, $wgRequest;
     if (wfReadOnly()) {
         $wgOut->readOnlyPage();
         return;
     }
     $this->mUserName = $wgRequest->getVal('wpName');
     $this->mOldpass = $wgRequest->getVal('wpPassword');
     $this->mNewpass = $wgRequest->getVal('wpNewPassword');
     $this->mRetype = $wgRequest->getVal('wpRetype');
     $this->setHeaders();
     $this->outputHeader();
     $wgOut->disallowUserJs();
     if (!$wgAuth->allowPasswordChange()) {
         $this->error(wfMsg('resetpass_forbidden'));
         return;
     }
     if (!$wgRequest->wasPosted() && !$wgUser->isLoggedIn()) {
         $this->error(wfMsg('resetpass-no-info'));
         return;
     }
     if ($wgRequest->wasPosted() && $wgRequest->getBool('wpCancel')) {
         $this->doReturnTo();
         return;
     }
     if ($wgRequest->wasPosted() && $wgUser->matchEditToken($wgRequest->getVal('token'))) {
         try {
             $this->attemptReset($this->mNewpass, $this->mRetype);
             $wgOut->addWikiMsg('resetpass_success');
             if (!$wgUser->isLoggedIn()) {
                 $data = array('action' => 'submitlogin', 'wpName' => $this->mUserName, 'wpPassword' => $this->mNewpass, 'returnto' => $wgRequest->getVal('returnto'));
                 if ($wgRequest->getCheck('wpRemember')) {
                     $data['wpRemember'] = 1;
                 }
                 $login = new LoginForm(new FauxRequest($data, true));
                 $login->execute();
             }
             $this->doReturnTo();
         } catch (PasswordError $e) {
             $this->error($e->getMessage());
         }
     }
     $this->showForm();
 }
示例#8
0
 public function onSuccess()
 {
     if ($this->getUser()->isLoggedIn()) {
         $this->getOutput()->wrapWikiMsg("<div class=\"successbox\">\n\$1\n</div>", 'changepassword-success');
         $this->getOutput()->returnToMain();
     } else {
         $request = $this->getRequest();
         LoginForm::setLoginToken();
         $token = LoginForm::getLoginToken();
         $data = array('action' => 'submitlogin', 'wpName' => $this->mUserName, 'wpDomain' => $this->mDomain, 'wpLoginToken' => $token, 'wpPassword' => $request->getVal('wpNewPassword')) + $request->getValues('wpRemember', 'returnto', 'returntoquery');
         $login = new LoginForm(new DerivativeRequest($request, $data, true));
         $login->setContext($this->getContext());
         $login->execute(null);
     }
 }
 /** */
 function showSuccess()
 {
     global $wgOut, $wgRequest, $wgUser;
     if ($wgUser->isLoggedIn()) {
         $wgOut->addWikiText(wfMsg('confirmemail_loggedin'));
     } else {
         $wgOut->addWikiText(wfMsg('confirmemail_success'));
         require_once 'SpecialUserlogin.php';
         $form = new LoginForm($wgRequest);
         $form->execute();
     }
 }
	/**
	 * Main execution point
	 */
	function execute( $par ) {
		global $wgAuth;

		$this->setHeaders();
		$this->outputHeader();
		$this->getOutput()->disallowUserJs();

		$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' );

		$user = $this->getUser();

		if ( !$user->isLoggedIn() && !LoginForm::getLoginToken() ) {
			LoginForm::setLoginToken();
		}

		if ( !$request->wasPosted() && !$user->isLoggedIn() ) {
			$this->error( $this->msg( 'resetpass-no-info' )->text() );

			return;
		}

		if ( $request->wasPosted() && $request->getBool( 'wpCancel' ) ) {
			$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->checkReadOnly();
		$this->checkPermissions();

		if ( $request->wasPosted() && $user->matchEditToken( $request->getVal( 'token' ) ) ) {
			try {
				$this->mDomain = $wgAuth->getDomain();
				if ( !$wgAuth->allowPasswordChange() ) {
					$this->error( $this->msg( 'resetpass_forbidden' )->text() );

					return;
				}

				if ( !$user->isLoggedIn()
					&& $request->getVal( 'wpLoginOnChangeToken' ) !== LoginForm::getLoginToken()
				) {
					// Potential CSRF (bug 62497)
					$this->error( $this->msg( 'sessionfailure' )->text() );
					return false;
				}

				$this->attemptReset( $this->mNewpass, $this->mRetype );

				if ( $user->isLoggedIn() ) {
					$this->getOutput()->wrapWikiMsg(
							"<div class=\"successbox\">\n$1\n</div>",
							'changepassword-success'
					);
					$this->getOutput()->returnToMain();
				} else {
					LoginForm::setLoginToken();
					$token = LoginForm::getLoginToken();
					$data = array(
						'action' => 'submitlogin',
						'wpName' => $this->mUserName,
						'wpDomain' => $this->mDomain,
						'wpLoginToken' => $token,
						'wpPassword' => $request->getVal( 'wpNewPassword' ),
					) + $request->getValues( 'wpRemember', 'returnto', 'returntoquery' );
					$login = new LoginForm( new DerivativeRequest( $request, $data, true ) );
					$login->setContext( $this->getContext() );
					$login->execute( null );
				}

				return;
			} catch ( PasswordError $e ) {
				$this->error( $e->getMessage() );
			}
		}
		$this->showForm();
	}