var $mAbortLoginErrorMsg = 'login-abort-generic';
private $mLoaded = false;
private $mSecureLoginUrl;
- // TODO Remove old forms and mShowVForm gating after all WMF wikis have
- // adapted messages and help links to new versions.
- private $mShowVForm;
/**
* @ var WebRequest
}
function getDescription() {
- if ( !$this->getUser()->isAllowed( 'createaccount' ) ) {
- return $this->msg( 'userloginnocreate' )->text();
- }
- if ( $this->mShowVForm ) {
- if ( $this->mType === 'signup' ) {
- return $this->msg( 'createaccount' )->text();
- } else {
- return $this->msg( 'login' )->text();
- }
+ if ( $this->mType === 'signup' ) {
+ return $this->msg( 'createaccount' )->text();
} else {
- return $this->msg( 'userlogin' )->text();
+ return $this->msg( 'login' )->text();
}
}
if ( $subPage == 'signup' ) {
$this->mType = 'signup';
}
- $this->mShowVForm = $this->shouldShowVForm();
-
$this->setHeaders();
// If logging in and not on HTTPS, either redirect to it or offer a link.
);
}
+ /**
+ * Add a "return to" link or redirect to it.
+ * Extensions can use this to reuse the "return to" logic after
+ * inject steps (such as redirection) into the login process.
+ *
+ * @param $type string, one of the following:
+ * - error: display a return to link ignoring $wgRedirectOnLogin
+ * - success: display a return to link using $wgRedirectOnLogin if needed
+ * - successredirect: send an HTTP redirect using $wgRedirectOnLogin if needed
+ * @param string $returnTo
+ * @param array|string $returnToQuery
+ * @param bool $stickHTTPs Keep redirect link on HTTPs
+ * @since 1.22
+ */
+ public function showReturnToPage(
+ $type, $returnTo = '', $returnToQuery = '', $stickHTTPs = false
+ ) {
+ $this->mReturnTo = $returnTo;
+ $this->mReturnToQuery = $returnToQuery;
+ $this->mStickHTTPS = $stickHTTPs;
+ $this->executeReturnTo( $type );
+ }
+
/**
* Add a "return to" link or redirect to it.
*
}
}
- /**
- * Whether to show new vertically laid out login form.
- * ?useNew=1 forces new style, ?useNew=0 forces old style,
- * otherwise consult $wgUseVFormUserLogin.
- * @return Boolean
- */
- private function shouldShowVForm() {
- global $wgUseVFormUserLogin;
-
- if ( $this->mType == 'signup' ) {
- return false;
- } else {
- return $this->mRequest->getBool( 'useNew', $wgUseVFormUserLogin );
- }
- }
-
/**
* @private
*/
if ( $this->mType == 'signup' ) {
$template = new UsercreateTemplate();
+
+ $out->addModuleStyles( array(
+ 'mediawiki.ui',
+ 'mediawiki.special.createaccount'
+ ) );
+ // XXX hack pending RL or JS parse() support for complex content messages
+ // https://bugzilla.wikimedia.org/show_bug.cgi?id=25349
+ $out->addJsConfigVars( 'wgCreateacctImgcaptchaHelp',
+ $this->msg( 'createacct-imgcaptcha-help' )->parse() );
+ $out->addModules( array(
+ 'mediawiki.special.createaccount.js'
+ ) );
+ // Must match number of benefits defined in messages
+ $template->set( 'benefitCount', 3 );
+
$q = 'action=submitlogin&type=signup';
$linkq = 'type=login';
- $linkmsg = 'gotaccount';
- $out->addModules( 'mediawiki.special.userlogin.signup' );
} else {
- if ( $this->mShowVForm ) {
- $template = new UserloginTemplateVForm();
- $out->addModuleStyles( array(
- 'mediawiki.ui',
- 'mediawiki.special.userlogin.vform'
- ) );
- } else {
- $template = new UserloginTemplate();
- }
+ $template = new UserloginTemplate();
+
+ $out->addModuleStyles( array(
+ 'mediawiki.ui',
+ 'mediawiki.special.userlogin'
+ ) );
+
$q = 'action=submitlogin&type=login';
$linkq = 'type=signup';
- $linkmsg = 'nologin';
}
if ( $this->mReturnTo !== '' ) {
if ( $wgLoginLanguageSelector && $this->mLanguage ) {
$linkq .= '&uselang=' . $this->mLanguage;
}
- if ( !$this->mShowVForm ) {
- $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() );
-
- } else {
- // Supply URL, login template creates the button.
- // (The template 'link' key, passed above, is obsolete in the VForm design.)
- $template->set( 'createOrLoginHref', $titleObj->getLocalURL( $linkq ) );
- }
+ // Supply URL, login template creates the button.
+ $template->set( 'createOrLoginHref', $titleObj->getLocalURL( $linkq ) );
} else {
$template->set( 'link', '' );
}