var $mSkipCookieCheck, $mReturnToQuery, $mToken, $mStickHTTPS;
var $mType, $mReason, $mRealName;
var $mAbortLoginErrorMsg = 'login-abort-generic';
- private $mLoaded = false, $mSecureLoginUrl;
- // TODO (spage 2013-02-13) Remove old forms by, say, release 1.22.
- private $mShowAgora;
+ private $mLoaded = false;
/**
* @var ExternalUser
$this->mReturnTo = '';
$this->mReturnToQuery = '';
}
-
- $this->mShowAgora = $this->shouldShowAgora();
}
function getDescription() {
- if ( !$this->getUser()->isAllowed( 'createaccount' ) ) {
- return $this->msg( 'userloginnocreate' )->text();
- }
- if ( $this->mShowAgora ) {
- return $this->msg( $this->mType === 'signup' ?
- 'createaccount' : 'login'
- )->text();
- } else {
- return $this->msg( 'userlogin' )->text();
- }
+ return $this->msg( $this->getUser()->isAllowed( 'createaccount' ) ?
+ 'userlogin' : 'userloginnocreate' )->text();
}
public function execute( $par ) {
$this->load();
$this->setHeaders();
- // If logging in and not on HTTPS, either redirect to it or offer a link.
global $wgSecureLogin;
if (
$this->mType !== 'signup' &&
+ $wgSecureLogin &&
WebRequest::detectProtocol() !== 'https'
) {
$title = $this->getFullTitle();
'wpStickHTTPS' => $this->mStickHTTPS
);
$url = $title->getFullURL( $query, false, PROTO_HTTPS );
- if ( $wgSecureLogin ) {
- $this->getOutput()->redirect( $url );
- return;
- } else {
- // A wiki without https login support should set wgServer to
- // http://somehost, in which case the secure URL generated
- // above actually won't be PROTO_HTTPS.
- if ( strncmp($url, PROTO_HTTPS, strlen( PROTO_HTTPS ) ) === 0 ) {
- $this->mSecureLoginUrl = $url;
- }
- }
+ $this->getOutput()->redirect( $url );
+ return;
}
if ( $par == 'signup' ) { # Check for [[Special:Userlogin/signup]]
}
}
- /**
- * Whether to show "Agora"-style forms.
- * ?useAgora=1 forces Agora style, ?useAgora=0 forces old-style,
- * otherwise consult $wgAgoraUserLogin or $wgAgoraCreateAccount.
- * @return Boolean
- */
- private function shouldShowAgora() {
- global $wgRequest, $wgAgoraUserLogin, $wgAgoraCreateAccount;
- $override = $wgRequest->getBool( 'useAgora' );
- if ( $override !== null ) {
- return $override;
- }
- if ( $this->mType == 'signup' ) {
- return (boolean) $wgAgoraCreateAccount;
- } else {
- return (boolean) $wgAgoraUserLogin;
- }
- }
-
- /**
- */
- private function isAgoraExtensionCSSAvailable() {
- global $wgResourceModules;
- return array_key_exists( 'ext.agora.base', $wgResourceModules );
- }
-
/**
* @private
*/
$titleObj = $this->getTitle();
$user = $this->getUser();
- $out = $this->getOutput();
if ( $this->mType == 'signup' ) {
// Block signup here if in readonly. Keeps user from
}
if ( $this->mType == 'signup' ) {
- $template = $this->mShowAgora
- ? new UsercreateTemplateAgora() : new UsercreateTemplate();
+ $template = new UsercreateTemplate();
$q = 'action=submitlogin&type=signup';
$linkq = 'type=login';
$linkmsg = 'gotaccount';
- $out->addModules( 'mediawiki.special.userlogin.signup' );
+ $this->getOutput()->addModules( 'mediawiki.special.userlogin.signup' );
} else {
- $template = $this->mShowAgora
- ? new UserloginTemplateAgora() : new UserloginTemplate();
+ $template = new UserloginTemplate();
$q = 'action=submitlogin&type=login';
$linkq = 'type=signup';
$linkmsg = 'nologin';
}
- if ( $this->mShowAgora ) {
- $out->addModules( array(
- // core Agora look, what gets loaded is dependent on skin.
- 'mediawiki.ui',
- $this->mType === 'signup' ?
- 'mediawiki.special.createaccount.agora' :
- 'mediawiki.special.userlogin.agora'
- ) );
- }
if ( $this->mReturnTo !== '' ) {
$returnto = '&returnto=' . wfUrlencode( $this->mReturnTo );
$linkq .= $returnto;
}
- # Don't show a "create account" link if the user can't.
+ # Don't show a "create account" link if the user can't
if( $this->showCreateOrLoginLink( $user ) ) {
# Pass any language selection on to the mode switch link
if( $wgLoginLanguageSelector && $this->mLanguage ) {
$linkq .= '&uselang=' . $this->mLanguage;
}
- if ( !$this->mShowAgora ) {
- $link = Html::element( 'a', array( 'href' => $titleObj->getLocalURL( $linkq ) ),
- $this->msg( $linkmsg . 'link' )->text() ); # Calling either 'gotaccountlink' or 'nologinlink'
-
- $template->set( 'link', $this->msg( $linkmsg )->rawParams( $link )->parse() );
+ $link = Html::element( 'a', array( 'href' => $titleObj->getLocalURL( $linkq ) ),
+ $this->msg( $linkmsg . 'link' )->text() ); # Calling either 'gotaccountlink' or 'nologinlink'
- } else {
- // Supply hyperlink, login template creates the button.
- // (The template 'link' key is obsolete in the Agora design.)
- $template->set( 'createOrLoginHref', $titleObj->getLocalURL( $linkq ) );
- }
+ $template->set( 'link', $this->msg( $linkmsg )->rawParams( $link )->parse() );
} else {
$template->set( 'link', '' );
}
}
}
- $template->set( 'secureLoginUrl', $this->mSecureLoginUrl );
// Use loginend-https for HTTPS requests if it's not blank, loginend otherwise
- // Ditto for signupend. Agora forms use neither.
+ // Ditto for signupend
$usingHTTPS = WebRequest::detectProtocol() == 'https';
$loginendHTTPS = $this->msg( 'loginend-https' );
$signupendHTTPS = $this->msg( 'signupend-https' );
wfRunHooks( 'UserLoginForm', array( &$template ) );
}
+ $out = $this->getOutput();
$out->disallowUserJs(); // just in case...
$out->addTemplate( $template );
}