$this->mAction = $request->getVal( 'action' );
$this->mRemember = $request->getCheck( 'wpRemember' );
$this->mFromHTTP = $request->getBool( 'fromhttp', false );
- $this->mStickHTTPS = ( !$this->mFromHTTP && $request->detectProtocol() === 'https' ) || $request->getBool( 'wpForceHttps', false );
+ $this->mStickHTTPS = ( !$this->mFromHTTP && $request->getProtocol() === 'https' ) || $request->getBool( 'wpForceHttps', false );
$this->mLanguage = $request->getText( 'uselang' );
$this->mSkipCookieCheck = $request->getCheck( 'wpSkipCookieCheck' );
$this->mToken = ( $this->mType == 'signup' ) ? $request->getVal( 'wpCreateaccountToken' ) : $request->getVal( 'wpLoginToken' );
// If logging in and not on HTTPS, either redirect to it or offer a link.
global $wgSecureLogin;
- if ( WebRequest::detectProtocol() !== 'https' ) {
+ if ( $this->mRequest->getProtocol() !== 'https' ) {
$title = $this->getFullTitle();
$query = array(
'returnto' => $this->mReturnTo,
'returntoquery' => $this->mReturnToQuery,
- );
+ 'title' => null,
+ ) + $this->mRequest->getQueryValues();
$url = $title->getFullURL( $query, false, PROTO_HTTPS );
if ( $wgSecureLogin && wfCanIPUseHTTPS( $this->getRequest()->getIP() ) ) {
$url = wfAppendQuery( $url, 'fromhttp=1' );
$status = $this->addNewaccountInternal();
if ( !$status->isGood() ) {
- $error = $this->getOutput()->parse( $status->getWikiText() );
- $this->mainLoginForm( $error );
+ $error = $status->getMessage();
+ $this->mainLoginForm( $error->toString() );
return;
}
# Create the account and abort if there's a problem doing so
$status = $this->addNewAccountInternal();
if ( !$status->isGood() ) {
- $error = $this->getOutput()->parse( $status->getWikiText() );
- $this->mainLoginForm( $error );
+ $error = $status->getMessage();
+ $this->mainLoginForm( $error->toString() );
return false;
}
if ( !wfRunHooks( 'AbortNewAccount', array( $u, &$abortError ) ) ) {
// Hook point to add extra creation throttles and blocks
wfDebug( "LoginForm::addNewAccountInternal: a hook blocked creation\n" );
- return Status::newFatal( new RawMessage( $abortError ) );
+ $abortError = new RawMessage( $abortError );
+ $abortError->text();
+ return Status::newFatal( $abortError );
}
// Hook point to check for exempt from account creation throttle
$template->set( 'remember', $user->getOption( 'rememberpassword' ) || $this->mRemember );
$template->set( 'cansecurelogin', ( $wgSecureLogin === true ) );
$template->set( 'stickhttps', (int)$this->mStickHTTPS );
-
- if ( $this->mType === 'signup' && $user->isLoggedIn() ) {
- $template->set( 'createAnother', true );
- } else {
- $template->set( 'createAnother', false );
- }
+ $template->set( 'loggedin', $user->isLoggedIn() );
+ $template->set( 'loggedinuser', $user->getName() );
if ( $this->mType == 'signup' ) {
if ( !self::getCreateaccountToken() ) {
$template->set( 'secureLoginUrl', $this->mSecureLoginUrl );
// Use loginend-https for HTTPS requests if it's not blank, loginend otherwise
// Ditto for signupend. New forms use neither.
- $usingHTTPS = WebRequest::detectProtocol() == 'https';
+ $usingHTTPS = $this->mRequest->getProtocol() == 'https';
$loginendHTTPS = $this->msg( 'loginend-https' );
$signupendHTTPS = $this->msg( 'signupend-https' );
if ( $usingHTTPS && !$loginendHTTPS->isBlank() ) {
* @return bool
*/
private function showCreateOrLoginLink( &$user ) {
- if ( $user->isLoggedIn() ) {
- return false;
- } elseif ( $this->mType == 'signup' ) {
+ if ( $this->mType == 'signup' ) {
return true;
} elseif ( $user->isAllowed( 'createaccount' ) ) {
return true;