31use Wikimedia\ScopedCallback;
76 abstract protected function successfulAction( $direct =
false, $extraMessages =
null );
87 parent::__construct( $name, $restriction );
93 protected function setRequest( array $data, $wasPosted =
null ) {
94 parent::setRequest( $data, $wasPosted );
95 $this->mLoadedRequest =
false;
102 if ( $this->mLoadedRequest ) {
105 $this->mLoadedRequest =
true;
108 $this->mPosted = $request->wasPosted();
109 $this->mAction = $request->getRawVal(
'action' );
110 $this->mFromHTTP = $request->getBool(
'fromhttp',
false )
111 || $request->getBool(
'wpFromhttp',
false );
112 $this->mStickHTTPS = $this->
getConfig()->get(
'ForceHTTPS' )
113 || ( !$this->mFromHTTP && $request->getProtocol() ===
'https' )
114 || $request->getBool(
'wpForceHttps',
false );
115 $this->mLanguage = $request->getText(
'uselang' );
116 $this->mReturnTo = $request->getVal(
'returnto',
'' );
117 $this->mReturnToQuery = $request->getVal(
'returntoquery',
'' );
129 if ( $this->mLoaded ) {
132 $this->mLoaded =
true;
138 MediaWikiServices::getInstance()->
getAuthManager()->securitySensitiveOperationStatus(
146 $this->mToken = $request->getVal( $this->
getTokenName() );
149 $entryError = $this->
msg( $request->getVal(
'error',
'' ) );
150 $entryWarning = $this->
msg( $request->getVal(
'warning',
'' ) );
155 $this->
msg(
'loginreqlink' )->text(),
158 'returnto' => $this->mReturnTo,
159 'returntoquery' => $this->mReturnToQuery,
160 'uselang' => $this->mLanguage ?:
null,
166 if ( $entryError->exists()
169 $this->mEntryErrorType =
'error';
170 $this->mEntryError = $entryError->rawParams( $loginreqlink )->parse();
172 } elseif ( $entryWarning->exists()
175 $this->mEntryErrorType =
'warning';
176 $this->mEntryError = $entryWarning->rawParams( $loginreqlink )->parse();
179 # 1. When switching accounts, it sucks to get automatically logged out
180 # 2. Do not return to PasswordReset after a successful password change
181 # but goto Wiki start page (Main_Page) instead ( T35997 )
182 $returnToTitle = Title::newFromText( $this->mReturnTo );
183 if ( is_object( $returnToTitle )
184 && ( $returnToTitle->isSpecial(
'Userlogout' )
185 || $returnToTitle->isSpecial(
'PasswordReset' ) )
187 $this->mReturnTo =
'';
188 $this->mReturnToQuery =
'';
195 $params = parent::getPreservedParams( $withToken );
197 'returnto' => $this->mReturnTo ?:
null,
198 'returntoquery' => $this->mReturnToQuery ?:
null,
201 $params[
'fromhttp'] = $this->mFromHTTP ?
'1' :
null;
209 return parent::beforeExecute(
$subPage );
217 if ( $this->mPosted ) {
218 $time = microtime(
true );
219 $profilingScope =
new ScopedCallback(
function () use ( $time ) {
220 $time = microtime(
true ) - $time;
221 $statsd = MediaWikiServices::getInstance()->getStatsdDataFactory();
222 $statsd->timing(
"timing.login.ui.{$this->authAction}", $time * 1000 );
226 $authManager = MediaWikiServices::getInstance()->getAuthManager();
227 $session = SessionManager::getGlobalSession();
234 $this->
getOutput()->enableClientCache(
false );
242 if ( !$session->canSetUser() ) {
243 throw new ErrorPageError(
'cannotloginnow-title',
'cannotloginnow-text', [
244 $session->getProvider()->describe( RequestContext::getMain()->getLanguage() )
247 throw new ErrorPageError(
'cannotlogin-title',
'cannotlogin-text' );
249 throw new ErrorPageError(
'cannotcreateaccount-title',
'cannotcreateaccount-text' );
266 if ( !$this->
isSignup() && !$this->mPosted && !$this->securityLevel &&
267 ( $this->mReturnTo !==
'' || $this->mReturnToQuery !==
'' ) &&
268 $this->
getUser()->isRegistered()
276 if ( $this->
getRequest()->getProtocol() !==
'https' ) {
280 ( $this->mEntryErrorType ===
'error' ?
'error'
281 :
'warning' ) => $this->mEntryError,
289 $this->
getOutput()->addVaryHeader(
'X-Forwarded-Proto' );
296 if ( substr( $url, 0, 8 ) ===
'https://' ) {
297 $this->mSecureLoginUrl = $url;
306 $this->
mainLoginForm( [],
'authpage-cannot-' . $this->authAction );
313 if ( $button_name ) {
314 $this->
getRequest()->setVal( $button_name,
true );
320 if ( !$status || !$status->isGood() ) {
321 $this->
mainLoginForm( $this->authRequests, $status ? $status->getMessage() :
'',
'error' );
326 $response = $status->getValue();
330 switch ( $response->status ) {
331 case AuthenticationResponse::PASS:
333 $this->proxyAccountCreation = $this->
isSignup() && !$this->
getUser()->isAnon();
337 !$this->proxyAccountCreation
338 && $response->loginRequest
344 if ( $response2->status !== AuthenticationResponse::PASS ) {
345 LoggerFactory::getInstance(
'login' )
346 ->error(
'Could not log in after account creation' );
347 $this->
successfulAction(
true, Status::newFatal(
'createacct-loginerror' ) );
352 if ( !$this->proxyAccountCreation ) {
359 case AuthenticationResponse::FAIL:
361 case AuthenticationResponse::RESTART:
362 unset( $this->authForm );
363 if ( $response->status === AuthenticationResponse::FAIL ) {
365 $messageType =
'error';
368 $messageType =
'warning';
370 $this->
logAuthResult(
false, $response->message ? $response->message->getKey() :
'-' );
372 $this->
mainLoginForm( $this->authRequests, $response->message, $messageType );
374 case AuthenticationResponse::REDIRECT:
375 unset( $this->authForm );
376 $this->
getOutput()->redirect( $response->redirectTarget );
378 case AuthenticationResponse::UI:
379 unset( $this->authForm );
380 $this->authAction = $this->
isSignup() ? AuthManager::ACTION_CREATE_CONTINUE
381 : AuthManager::ACTION_LOGIN_CONTINUE;
382 $this->authRequests = $response->neededRequests;
383 $this->
mainLoginForm( $response->neededRequests, $response->message, $response->messageType );
386 throw new LogicException(
'invalid AuthenticationResponse' );
408 $fields = AuthenticationRequest::mergeFieldInfo( $this->authRequests );
409 foreach ( $fields as $fieldname => $field ) {
410 if ( !isset( $field[
'type'] ) ) {
413 if ( !empty( $field[
'skippable'] ) ) {
416 if ( $field[
'type'] ===
'button' ) {
417 if ( $button_name !==
null ) {
421 $button_name = $fieldname;
423 } elseif ( $field[
'type'] !==
'null' ) {
440 $type,
$title, $msgname, $injected_html, $extraMessages
443 $out->setPageTitle(
$title );
447 if ( $extraMessages ) {
448 $extraMessages = Status::wrap( $extraMessages );
449 $out->addWikiTextAsInterface(
450 $extraMessages->getWikiText(
false,
false, $this->getLanguage() )
454 $out->addHTML( $injected_html );
457 $helper->showReturnToPage(
$type, $this->mReturnTo, $this->mReturnToQuery, $this->mStickHTTPS );
476 $type, $returnTo =
'', $returnToQuery =
'', $stickHTTPS =
false
479 $helper->showReturnToPage(
$type, $returnTo, $returnToQuery, $stickHTTPS );
489 $context = RequestContext::getMain();
491 if ( $context !== $localContext ) {
496 $user = $context->getRequest()->getSession()->getUser();
499 $context->setUser( $user );
501 $wgLang = $context->getLanguage();
518 protected function mainLoginForm( array $requests, $msg =
'', $msgtype =
'error' ) {
526 $this->authForm =
null;
527 $requests = MediaWikiServices::getInstance()->getAuthManager()
528 ->getAuthenticationRequests( $this->authAction, $user );
532 $out->addModuleStyles( [
534 'mediawiki.ui.button',
535 'mediawiki.ui.checkbox',
536 'mediawiki.ui.input',
537 'mediawiki.special.userlogin.common.styles'
541 $out->addJsConfigVars(
'wgCreateacctImgcaptchaHelp',
542 $this->
msg(
'createacct-imgcaptcha-help' )->parse() );
545 $out->addModules(
'mediawiki.special.createaccount' );
546 $out->addModuleStyles( [
547 'mediawiki.special.userlogin.signup.styles'
551 $out->addModuleStyles( [
552 'mediawiki.special.userlogin.login.styles'
555 $out->disallowUserJs();
557 $form = $this->
getAuthForm( $requests, $this->authAction, $msg, $msgtype );
558 $form->prepareForm();
560 $submitStatus = Status::newGood();
561 if ( $msg && $msgtype ===
'warning' ) {
562 $submitStatus->warning( $msg );
563 } elseif ( $msg && $msgtype ===
'error' ) {
564 $submitStatus->fatal( $msg );
570 $this->
getUser()->isRegistered() &&
571 $this->authAction !== AuthManager::ACTION_LOGIN_CONTINUE
573 $reauthMessage = $this->securityLevel ?
'userlogin-reauth' :
'userlogin-loggedin';
574 $submitStatus->warning( $reauthMessage, $this->
getUser()->
getName() );
577 $formHtml = $form->getHTML( $submitStatus );
591 $loginPrompt = $this->
isSignup() ?
'' : Html::rawElement(
'div',
592 [
'id' =>
'userloginprompt' ], $this->
msg(
'loginprompt' )->parseAsBlock() );
594 $signupStartMsg = $this->
msg(
'signupstart' );
595 $signupStart = ( $this->
isSignup() && !$signupStartMsg->isDisabled() )
596 ? Html::rawElement(
'div', [
'id' =>
'signupstart' ], $signupStartMsg->parseAsBlock() ) :
'';
597 if ( $languageLinks ) {
598 $languageLinks = Html::rawElement(
'div', [
'id' =>
'languagelinks' ],
599 Html::rawElement(
'p', [], $languageLinks )
603 $benefitsContainer =
'';
611 for ( $benefitIdx = 1; $benefitIdx <= $benefitCount; $benefitIdx++ ) {
612 $headUnescaped = $this->
msg(
"createacct-benefit-head$benefitIdx" )->text();
613 $iconClass = $this->
msg(
"createacct-benefit-icon$benefitIdx" )->text();
614 $benefitList .= Html::rawElement(
'div', [
'class' =>
"mw-number-text $iconClass" ],
615 Html::rawElement(
'h3', [],
616 $this->
msg(
"createacct-benefit-head$benefitIdx" )->escaped()
618 . Html::rawElement(
'p', [],
619 $this->
msg(
"createacct-benefit-body$benefitIdx" )->params( $headUnescaped )->escaped()
623 $benefitsContainer = Html::rawElement(
'div', [
'class' =>
'mw-createacct-benefits-container' ],
624 Html::rawElement(
'h2', [], $this->
msg(
'createacct-benefit-heading' )->escaped() )
625 . Html::rawElement(
'div', [
'class' =>
'mw-createacct-benefits-list' ],
631 $html = Html::rawElement(
'div', [
'class' =>
'mw-ui-container' ],
635 . Html::rawElement(
'div', [
'id' =>
'userloginForm' ],
652 protected function getAuthForm( array $requests, $action, $msg =
'', $msgType =
'error' ) {
655 if ( isset( $this->authForm ) ) {
659 $usingHTTPS = $this->
getRequest()->getProtocol() ===
'https';
662 $fieldInfo = AuthenticationRequest::mergeFieldInfo( $requests );
668 if ( $context->getRequest() !== $this->getRequest() ) {
673 $form = HTMLForm::factory(
'vform', $formDescriptor, $context );
675 $form->addHiddenField(
'authAction', $this->authAction );
676 if ( $this->mLanguage ) {
677 $form->addHiddenField(
'uselang', $this->mLanguage );
679 $form->addHiddenField(
'force', $this->securityLevel );
682 if ( $config->get(
'SecureLogin' ) && !$config->get(
'ForceHTTPS' ) ) {
685 $form->addHiddenField(
'wpForceHttps', (
int)$this->mStickHTTPS );
686 $form->addHiddenField(
'wpFromhttp', $usingHTTPS );
692 $form->setName(
'userlogin' . ( $this->
isSignup() ?
'2' :
'' ) );
694 $form->setId(
'userlogin2' );
697 $form->suppressDefaultSubmit();
699 $this->authForm = $form;
706 array $requests, array $fieldInfo, array &$formDescriptor, $action
730 $isRegistered = $this->
getUser()->isRegistered();
731 $continuePart = $this->
isContinued() ?
'continue-' :
'';
732 $anotherPart = $isRegistered ?
'another-' :
'';
734 $expiration = $this->
getRequest()->getSession()->getProvider()->getRememberUserDuration();
735 $expirationDays = ceil( $expiration / ( 3600 * 24 ) );
736 $secureLoginLink =
'';
737 if ( $this->mSecureLoginUrl ) {
738 $secureLoginLink = Html::element(
'a', [
739 'href' => $this->mSecureLoginUrl,
740 'class' =>
'mw-ui-flush-right mw-secure',
741 ], $this->
msg(
'userlogin-signwithsecure' )->text() );
743 $usernameHelpLink =
'';
744 if ( !$this->
msg(
'createacct-helpusername' )->isDisabled() ) {
745 $usernameHelpLink = Html::rawElement(
'span', [
746 'class' =>
'mw-ui-flush-right',
747 ], $this->
msg(
'createacct-helpusername' )->parse() );
751 $fieldDefinitions = [
757 'default' => Html::element(
'div', [
'id' =>
'mw-createacct-status-area' ] ),
761 'label-raw' => $this->
msg(
'userlogin-yourname' )->escaped() . $usernameHelpLink,
763 'placeholder-message' => $isRegistered ?
'createacct-another-username-ph'
764 :
'userlogin-yourname-ph',
769 'label-message' =>
'createaccountmail',
770 'name' =>
'wpCreateaccountMail',
771 'id' =>
'wpCreateaccountMail',
774 'id' =>
'wpPassword2',
775 'autocomplete' =>
'new-password',
776 'placeholder-message' =>
'createacct-yourpassword-ph',
777 'help-message' =>
'createacct-useuniquepass',
778 'hide-if' => [
'===',
'wpCreateaccountMail',
'1' ],
782 'type' =>
'password',
783 'label-message' =>
'createacct-yourpasswordagain',
785 'cssclass' =>
'loginPassword',
787 'autocomplete' =>
'new-password',
788 'validation-callback' =>
function ( $value, $alldata ) {
789 if ( empty( $alldata[
'mailpassword'] ) && !empty( $alldata[
'password'] ) ) {
791 return $this->
msg(
'htmlform-required' );
792 } elseif ( $value !== $alldata[
'password'] ) {
793 return $this->
msg(
'badretype' );
798 'hide-if' => [
'===',
'wpCreateaccountMail',
'1' ],
799 'placeholder-message' =>
'createacct-yourpasswordagain-ph',
803 'label-message' => $wgEmailConfirmToEdit ?
'createacct-emailrequired'
804 :
'createacct-emailoptional',
806 'cssclass' =>
'loginText',
809 'autocomplete' =>
'email',
812 'validation-callback' =>
function ( $value, $alldata ) {
820 return $this->
msg(
'noemailtitle' );
821 } elseif ( !$value && !empty( $alldata[
'mailpassword'] ) ) {
823 return $this->
msg(
'noemailcreate' );
824 } elseif ( $value && !Sanitizer::validateEmail( $value ) ) {
825 return $this->
msg(
'invalidemailaddress' );
826 } elseif ( is_string( $value ) && strlen( $value ) > 255 ) {
827 return $this->
msg(
'changeemail-maxlength' );
831 'placeholder-message' =>
'createacct-' . $anotherPart .
'email-ph',
835 'help-message' => $isRegistered ?
'createacct-another-realname-tip'
836 :
'prefs-help-realname',
837 'label-message' =>
'createacct-realname',
838 'cssclass' =>
'loginText',
840 'id' =>
'wpRealName',
841 'autocomplete' =>
'name',
846 'label-message' =>
'createacct-reason',
847 'cssclass' =>
'loginText',
850 'validation-callback' =>
function ( $value, $alldata ) {
853 if ( $value && Sanitizer::validateEmail( $value ) ) {
854 if ( $this->reasonValidatorResult !==
null ) {
857 $this->reasonValidatorResult =
true;
858 $authManager = MediaWikiServices::getInstance()->getAuthManager();
861 $this->reasonValidatorResult = $this->
msg(
'createacct-reason-confirm' );
867 'placeholder-message' =>
'createacct-reason-ph',
872 'default' => $this->
msg(
'createacct-' . $anotherPart . $continuePart .
874 'name' =>
'wpCreateaccount',
875 'id' =>
'wpCreateaccount',
883 $passwordRequest = AuthenticationRequest::getRequestByClass( $this->authRequests,
884 PasswordAuthenticationRequest::class );
885 $changePassword = $passwordRequest && $passwordRequest->action == AuthManager::ACTION_CHANGE;
886 $fieldDefinitions = [
889 'label-raw' => $this->
msg(
'userlogin-yourname' )->escaped() . $secureLoginLink,
891 'placeholder-message' =>
'userlogin-yourname-ph',
892 ] + ( $changePassword ? [
895 'baseField' =>
'password',
898 'cssclass' =>
'mw-htmlform-hidden-field',
903 'autocomplete' =>
'new-password',
904 'placeholder-message' =>
'createacct-yourpassword-ph',
905 'help-message' =>
'createacct-useuniquepass',
907 'id' =>
'wpPassword1',
908 'autocomplete' =>
'current-password',
909 'placeholder-message' =>
'userlogin-yourpassword-ph',
913 'type' =>
'password',
914 'autocomplete' =>
'new-password',
915 'placeholder-message' =>
'createacct-yourpasswordagain-ph',
921 'cssclass' =>
'mw-userlogin-rememberme',
922 'name' =>
'wpRemember',
923 'label-message' => $this->
msg(
'userlogin-remembermypassword' )
924 ->numParams( $expirationDays ),
925 'id' =>
'wpRemember',
930 'default' => $this->
msg(
'pt-login-' . $continuePart .
'button' )->text(),
931 'id' =>
'wpLoginAttempt',
937 'cssclass' =>
'mw-form-related-link-container mw-userlogin-help',
940 'default' => Html::element(
'a', [
941 'href' => Skin::makeInternalOrExternalUrl( $this->
msg(
'helplogin-url' )
942 ->inContentLanguage()
944 ], $this->
msg(
'userlogin-helplink2' )->text() ),
955 $fieldDefinitions[
'username'] += [
958 'cssclass' =>
'loginText',
960 'autocomplete' =>
'username',
963 $fieldDefinitions[
'password'] += [
964 'type' =>
'password',
966 'name' =>
'wpPassword',
967 'cssclass' =>
'loginPassword',
972 if ( $this->mEntryError ) {
973 $fieldDefinitions[
'entryError'] = [
975 'default' => Html::rawElement(
'div', [
'class' => $this->mEntryErrorType .
'box', ],
976 $this->mEntryError ),
983 unset( $fieldDefinitions[
'linkcontainer'], $fieldDefinitions[
'signupend'] );
988 $signupendMsg = $this->
msg(
'signupend' );
989 $signupendHttpsMsg = $this->
msg(
'signupend-https' );
990 if ( !$signupendMsg->isDisabled() ) {
991 $usingHTTPS = $this->
getRequest()->getProtocol() ===
'https';
992 $signupendText = ( $usingHTTPS && !$signupendHttpsMsg->isBlank() )
993 ? $signupendHttpsMsg->parse() : $signupendMsg->parse();
994 $fieldDefinitions[
'signupend'] = [
997 'default' => Html::rawElement(
'div', [
'id' =>
'signupend' ], $signupendText ),
1003 $passwordReset = MediaWikiServices::getInstance()->getPasswordReset();
1004 if ( $passwordReset->isAllowed( $this->getUser() )->isGood() ) {
1005 $fieldDefinitions[
'passwordReset'] = [
1008 'cssclass' =>
'mw-form-related-link-container',
1011 $this->
msg(
'userlogin-resetpassword-link' )->text()
1023 if ( $this->mLanguage ) {
1024 $linkq .=
'&uselang=' . urlencode( $this->mLanguage );
1026 $isRegistered = $this->
getUser()->isRegistered();
1028 $fieldDefinitions[
'createOrLogin'] = [
1031 'linkQuery' => $linkq,
1032 'default' =>
function ( $params ) use ( $isRegistered, $linkTitle ) {
1033 return Html::rawElement(
'div',
1034 [
'id' =>
'mw-createaccount' . ( !$isRegistered ?
'-cta' :
'' ),
1035 'class' => ( $isRegistered ?
'mw-form-related-link-container' :
'mw-ui-vform-field' ) ],
1036 ( $isRegistered ?
'' : $this->
msg(
'userlogin-noaccount' )->escaped() )
1037 . Html::element(
'a',
1039 'id' =>
'mw-createaccount-join' . ( $isRegistered ?
'-loggedin' :
'' ),
1040 'href' => $linkTitle->getLocalURL( $params[
'linkQuery'] ),
1041 'class' => ( $isRegistered ?
'' :
'mw-ui-button' ),
1045 $isRegistered ?
'userlogin-createanother' :
'userlogin-joinproject'
1055 return $fieldDefinitions;
1083 if ( $this->mReturnTo !==
'' ) {
1084 $returnto =
'returnto=' .
wfUrlencode( $this->mReturnTo );
1085 if ( $this->mReturnToQuery !==
'' ) {
1086 $returnto .=
'&returntoquery=' .
wfUrlencode( $this->mReturnToQuery );
1099 $this->
getContext()->getAuthority()->isAllowed(
'createaccount' );
1103 return $this->
isSignup() ?
'wpCreateaccountToken' :
'wpLoginToken';
1113 $msg = $this->
msg(
'loginlanguagelinks' )->inContentLanguage();
1114 if ( $msg->isBlank() ) {
1117 $langs = explode(
"\n", $msg->text() );
1119 foreach ( $langs as
$lang ) {
1121 $parts = explode(
'|',
$lang );
1122 if ( count( $parts ) >= 2 ) {
1127 return count( $links ) > 0 ? $this->
msg(
'loginlanguagelabel' )->rawParams(
1128 $this->
getLanguage()->pipeList( $links ) )->escaped() :
'';
1142 return htmlspecialchars( $text );
1144 $query = [
'uselang' =>
$lang ];
1145 if ( $this->mReturnTo !==
'' ) {
1151 $targetLanguage = MediaWikiServices::getInstance()->getLanguageFactory()
1152 ->getLanguage(
$lang );
1153 $attr[
'lang'] = $attr[
'hreflang'] = $targetLanguage->getHtmlCode();
1174 isset( $formDescriptor[
'username'] ) &&
1175 !isset( $formDescriptor[
'username'][
'default'] ) &&
1179 if ( $user->isRegistered() ) {
1180 $formDescriptor[
'username'][
'default'] = $user->getName();
1182 $formDescriptor[
'username'][
'default'] =
1183 $this->
getRequest()->getSession()->suggestLoginUsername();
1190 unset( $formDescriptor[
'createaccount'], $formDescriptor[
'loginattempt'] );
1197 isset( $formDescriptor[
'username'] )
1198 && empty( $formDescriptor[
'username'][
'default'] )
1199 && !$this->
getRequest()->getCheck(
'wpName' )
1201 $formDescriptor[
'username'][
'autofocus'] =
true;
1202 } elseif ( isset( $formDescriptor[
'password'] ) ) {
1203 $formDescriptor[
'password'][
'autofocus'] =
true;
$wgDisableCookieCheck
By default, MediaWiki checks if the client supports cookies during the login process,...
$wgLoginLanguageSelector
Show a bar of language selection links in the user login and user registration forms; edit the "login...
$wgSecureLogin
This is to let user authenticate using https when they come from http.
$wgEmailConfirmToEdit
Should editors be required to have a validated e-mail address before being allowed to edit?
$wgUseMediaWikiUIEverywhere
Temporary variable that applies MediaWiki UI wherever it can be supported.
wfUrlencode( $s)
We want some things to be included as literal characters in our title URLs for prettiness,...
wfAppendQuery( $url, $query)
Append a query string to an existing URL, which may or may not already have query string parameters a...
wfEscapeWikiText( $text)
Escapes the given text so that it may be output using addWikiText() without any linking,...
if(MW_ENTRY_POINT==='index') MediaWiki Session SessionId null $wgInitialSessionId
The persistent session ID (if any) loaded at startup.
A special page subclass for authentication-related special pages.
getContinueAction( $action)
Gets the _CONTINUE version of an action.
isActionAllowed( $action)
Checks whether AuthManager is ready to perform the action.
loadAuth( $subPage, $authAction=null, $reset=false)
Load or initialize $authAction, $authRequests and $subPage.
fieldInfoToFormDescriptor(array $requests, array $fieldInfo, $action)
Turns a field info array into a form descriptor.
getDefaultAction( $subPage)
Get the default action for this special page, if none is given via URL/POST data.
needsSubmitButton(array $requests)
Returns true if the form built from the given AuthenticationRequests needs a submit button.
string $subPage
Subpage of the special page.
isContinued()
Returns true if this is not the first step of the authentication.
static mergeDefaultFormDescriptor(array $fieldInfo, array $formDescriptor, array $defaultFormDescriptor)
Apply defaults to a form descriptor, without creating non-existend fields.
getRequest()
Get the WebRequest being used for this instance.
trySubmit()
Attempts to do an authentication step with the submitted data.
getToken()
Returns the CSRF token.
addTabIndex(&$formDescriptor)
Adds a sequential tabindex starting from 1 to all form elements.
An IContextSource implementation which will inherit context from another source but allow individual ...
An error page which can definitely be safely rendered using the OutputPage.
Helper functions for the login form that need to be shared with other special pages (such as CentralA...
static getValidErrorMessages()
Returns an array of all valid error messages.
Holds shared logic for login and account creation pages.
mainLoginForm(array $requests, $msg='', $msgtype='error')
canBypassForm(&$button_name)
Determine if the login form can be bypassed.
getFieldDefinitions()
Create a HTMLForm descriptor for the core login fields.
getPreservedParams( $withToken=false)
Returns URL query parameters which can be used to reload the page (or leave and return) while preserv...
logAuthResult( $success, $status=null)
Logs to the authmanager-stats channel.
onAuthChangeFormFields(array $requests, array $fieldInfo, array &$formDescriptor, $action)
Change the form descriptor that determines how a field will look in the authentication form....
setSessionUserForCurrentRequest()
Replace some globals to make sure the fact that the user has just been logged in is reflected in the ...
showSuccessPage( $type, $title, $msgname, $injected_html, $extraMessages)
Show the success page.
getReturnToQueryStringFragment()
Returns a string that can be appended to the URL (without encoding) to preserve the return target.
User $targetUser
FIXME another flag for passing data.
successfulAction( $direct=false, $extraMessages=null)
showExtraInformation()
Show extra information such as password recovery information, link from login to signup,...
getPageHtml( $formHtml)
Add page elements which are outside the form.
hasSessionCookie()
Check if a session cookie is present.
loadRequestParameters()
Load basic request parameters for this Special page.
__construct( $name, $restriction='')
getAuthForm(array $requests, $action, $msg='', $msgType='error')
Generates a form from the given request.
getTokenName()
Returns the name of the CSRF token (under which it should be found in the POST or GET data).
makeLanguageSelectorLink( $text, $lang)
Create a language selector link for a particular language Links back to this page preserving type and...
bool $proxyAccountCreation
True if the user if creating an account for someone else.
showCreateAccountLink()
Whether the login/create account form should display a link to the other form (in addition to whateve...
getGroupName()
Under which header this special page is listed in Special:SpecialPages See messages 'specialpages-gro...
postProcessFormDescriptor(&$formDescriptor, $requests)
setRequest(array $data, $wasPosted=null)
Override the POST data, GET data from the real request is preserved.
showReturnToPage( $type, $returnTo='', $returnToQuery='', $stickHTTPS=false)
Add a "return to" link or redirect to it.
makeLanguageSelector()
Produce a bar of links which allow the user to select another language during login/registration but ...
load( $subPage)
Load data from request.
setContext( $context)
Sets the context this SpecialPage is executed in.
getName()
Get the name of this Special Page.
setHeaders()
Sets headers - this should be called from the execute() method of all derived classes!
getOutput()
Get the OutputPage being used for this instance.
getUser()
Shortcut to get the User executing this instance.
checkPermissions()
Checks if userCanExecute, and if not throws a PermissionsError.
static getTitleFor( $name, $subpage=false, $fragment='')
Get a localised Title object for a specified special page name If you don't need a full Title object,...
AuthManager null $authManager
getContext()
Gets the context this SpecialPage is executed in.
msg( $key,... $params)
Wrapper around wfMessage that sets the current context.
getConfig()
Shortcut to get main config object.
getPageTitle( $subpage=false)
Get a self-referential title object.
getLanguage()
Shortcut to get user's language.
getFullTitle()
Return the full title, including $par.
static setUser( $user)
Reset the stub global user to a different "real" user object, while ensuring that any method calls on...
The User object encapsulates all of the user-specific settings (user_id, name, rights,...
static newFromName( $name, $validate='valid')
if(!isset( $args[0])) $lang