31use Wikimedia\ScopedCallback;
76 abstract protected function successfulAction( $direct =
false, $extraMessages =
null );
87 parent::__construct( $name );
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->getVal(
'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 );
241 if ( !$this->
isSignup() && !$authManager->canAuthenticateNow() ) {
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' );
248 } elseif ( $this->
isSignup() && !$authManager->canCreateAccounts() ) {
249 throw new ErrorPageError(
'cannotcreateaccount-title',
'cannotcreateaccount-text' );
266 if ( !$this->
isSignup() && !$this->mPosted && !$this->securityLevel &&
267 ( $this->mReturnTo !==
'' || $this->mReturnToQuery !==
'' ) &&
276 if ( $this->
getRequest()->getProtocol() !==
'https' ) {
280 ( $this->mEntryErrorType ===
'error' ?
'error'
281 :
'warning' ) => $this->mEntryError,
291 $this->
getOutput()->addVaryHeader(
'X-Forwarded-Proto' );
298 if ( substr( $url, 0, 8 ) ===
'https://' ) {
299 $this->mSecureLoginUrl = $url;
308 $this->
mainLoginForm( [],
'authpage-cannot-' . $this->authAction );
315 if ( $button_name ) {
316 $this->
getRequest()->setVal( $button_name,
true );
322 if ( !$status || !$status->isGood() ) {
323 $this->
mainLoginForm( $this->authRequests, $status ? $status->getMessage() :
'',
'error' );
328 $response = $status->getValue();
332 switch ( $response->status ) {
333 case AuthenticationResponse::PASS:
335 $this->proxyAccountCreation = $this->
isSignup() && !$this->
getUser()->isAnon();
339 !$this->proxyAccountCreation
340 && $response->loginRequest
341 && $authManager->canAuthenticateNow()
344 $response2 = $authManager->beginAuthentication( [ $response->loginRequest ],
346 if ( $response2->status !== AuthenticationResponse::PASS ) {
347 LoggerFactory::getInstance(
'login' )
348 ->error(
'Could not log in after account creation' );
349 $this->
successfulAction(
true, Status::newFatal(
'createacct-loginerror' ) );
354 if ( !$this->proxyAccountCreation ) {
361 case AuthenticationResponse::FAIL:
363 case AuthenticationResponse::RESTART:
364 unset( $this->authForm );
365 if ( $response->status === AuthenticationResponse::FAIL ) {
367 $messageType =
'error';
370 $messageType =
'warning';
372 $this->
logAuthResult(
false, $response->message ? $response->message->getKey() :
'-' );
374 $this->
mainLoginForm( $this->authRequests, $response->message, $messageType );
376 case AuthenticationResponse::REDIRECT:
377 unset( $this->authForm );
378 $this->
getOutput()->redirect( $response->redirectTarget );
380 case AuthenticationResponse::UI:
381 unset( $this->authForm );
382 $this->authAction = $this->
isSignup() ? AuthManager::ACTION_CREATE_CONTINUE
383 : AuthManager::ACTION_LOGIN_CONTINUE;
384 $this->authRequests = $response->neededRequests;
385 $this->
mainLoginForm( $response->neededRequests, $response->message, $response->messageType );
388 throw new LogicException(
'invalid AuthenticationResponse' );
410 $fields = AuthenticationRequest::mergeFieldInfo( $this->authRequests );
411 foreach ( $fields as $fieldname => $field ) {
412 if ( !isset( $field[
'type'] ) ) {
415 if ( !empty( $field[
'skippable'] ) ) {
418 if ( $field[
'type'] ===
'button' ) {
419 if ( $button_name !==
null ) {
423 $button_name = $fieldname;
425 } elseif ( $field[
'type'] !==
'null' ) {
442 $type,
$title, $msgname, $injected_html, $extraMessages
445 $out->setPageTitle(
$title );
449 if ( $extraMessages ) {
450 $extraMessages = Status::wrap( $extraMessages );
451 $out->addWikiTextAsInterface(
452 $extraMessages->getWikiText(
false,
false, $this->getLanguage() )
456 $out->addHTML( $injected_html );
459 $helper->showReturnToPage(
$type, $this->mReturnTo, $this->mReturnToQuery, $this->mStickHTTPS );
478 $type, $returnTo =
'', $returnToQuery =
'', $stickHTTPS =
false
481 $helper->showReturnToPage(
$type, $returnTo, $returnToQuery, $stickHTTPS );
491 $context = RequestContext::getMain();
493 if ( $context !== $localContext ) {
498 $user = $context->getRequest()->getSession()->getUser();
501 $context->setUser( $user );
503 $wgLang = $context->getLanguage();
520 protected function mainLoginForm( array $requests, $msg =
'', $msgtype =
'error' ) {
528 $this->authForm =
null;
529 $requests = MediaWikiServices::getInstance()->getAuthManager()
530 ->getAuthenticationRequests( $this->authAction, $user );
534 $out->addModuleStyles( [
536 'mediawiki.ui.button',
537 'mediawiki.ui.checkbox',
538 'mediawiki.ui.input',
539 'mediawiki.special.userlogin.common.styles'
543 $out->addJsConfigVars(
'wgCreateacctImgcaptchaHelp',
544 $this->
msg(
'createacct-imgcaptcha-help' )->parse() );
547 $out->addModules(
'mediawiki.special.createaccount' );
548 $out->addModuleStyles( [
549 'mediawiki.special.userlogin.signup.styles'
553 $out->addModuleStyles( [
554 'mediawiki.special.userlogin.login.styles'
557 $out->disallowUserJs();
559 $form = $this->
getAuthForm( $requests, $this->authAction, $msg, $msgtype );
560 $form->prepareForm();
562 $submitStatus = Status::newGood();
563 if ( $msg && $msgtype ===
'warning' ) {
564 $submitStatus->warning( $msg );
565 } elseif ( $msg && $msgtype ===
'error' ) {
566 $submitStatus->fatal( $msg );
572 $this->
getUser()->isLoggedIn() &&
573 $this->authAction !== AuthManager::ACTION_LOGIN_CONTINUE
575 $reauthMessage = $this->securityLevel ?
'userlogin-reauth' :
'userlogin-loggedin';
576 $submitStatus->warning( $reauthMessage, $this->
getUser()->
getName() );
579 $formHtml = $form->getHTML( $submitStatus );
593 $loginPrompt = $this->
isSignup() ?
'' : Html::rawElement(
'div',
594 [
'id' =>
'userloginprompt' ], $this->
msg(
'loginprompt' )->parseAsBlock() );
596 $signupStartMsg = $this->
msg(
'signupstart' );
597 $signupStart = ( $this->
isSignup() && !$signupStartMsg->isDisabled() )
598 ? Html::rawElement(
'div', [
'id' =>
'signupstart' ], $signupStartMsg->parseAsBlock() ) :
'';
599 if ( $languageLinks ) {
600 $languageLinks = Html::rawElement(
'div', [
'id' =>
'languagelinks' ],
601 Html::rawElement(
'p', [], $languageLinks )
605 $benefitsContainer =
'';
613 for ( $benefitIdx = 1; $benefitIdx <= $benefitCount; $benefitIdx++ ) {
614 $headUnescaped = $this->
msg(
"createacct-benefit-head$benefitIdx" )->text();
615 $iconClass = $this->
msg(
"createacct-benefit-icon$benefitIdx" )->text();
616 $benefitList .= Html::rawElement(
'div', [
'class' =>
"mw-number-text $iconClass" ],
617 Html::rawElement(
'h3', [],
618 $this->
msg(
"createacct-benefit-head$benefitIdx" )->escaped()
620 . Html::rawElement(
'p', [],
621 $this->
msg(
"createacct-benefit-body$benefitIdx" )->params( $headUnescaped )->escaped()
625 $benefitsContainer = Html::rawElement(
'div', [
'class' =>
'mw-createacct-benefits-container' ],
626 Html::rawElement(
'h2', [], $this->
msg(
'createacct-benefit-heading' )->escaped() )
627 . Html::rawElement(
'div', [
'class' =>
'mw-createacct-benefits-list' ],
633 $html = Html::rawElement(
'div', [
'class' =>
'mw-ui-container' ],
637 . Html::rawElement(
'div', [
'id' =>
'userloginForm' ],
654 protected function getAuthForm( array $requests, $action, $msg =
'', $msgType =
'error' ) {
657 if ( isset( $this->authForm ) ) {
661 $usingHTTPS = $this->
getRequest()->getProtocol() ===
'https';
664 $fieldInfo = AuthenticationRequest::mergeFieldInfo( $requests );
670 if ( $context->getRequest() !== $this->getRequest() ) {
675 $form = HTMLForm::factory(
'vform', $formDescriptor, $context );
677 $form->addHiddenField(
'authAction', $this->authAction );
678 if ( $this->mLanguage ) {
679 $form->addHiddenField(
'uselang', $this->mLanguage );
681 $form->addHiddenField(
'force', $this->securityLevel );
684 if ( $config->get(
'SecureLogin' ) && !$config->get(
'ForceHTTPS' ) ) {
687 $form->addHiddenField(
'wpForceHttps', (
int)$this->mStickHTTPS );
688 $form->addHiddenField(
'wpFromhttp', $usingHTTPS );
694 $form->setName(
'userlogin' . ( $this->
isSignup() ?
'2' :
'' ) );
696 $form->setId(
'userlogin2' );
699 $form->suppressDefaultSubmit();
701 $this->authForm = $form;
708 array $requests, array $fieldInfo, array &$formDescriptor, $action
732 $isLoggedIn = $this->
getUser()->isLoggedIn();
733 $continuePart = $this->
isContinued() ?
'continue-' :
'';
734 $anotherPart = $isLoggedIn ?
'another-' :
'';
736 $expiration = $this->
getRequest()->getSession()->getProvider()->getRememberUserDuration();
737 $expirationDays = ceil( $expiration / ( 3600 * 24 ) );
738 $secureLoginLink =
'';
739 if ( $this->mSecureLoginUrl ) {
740 $secureLoginLink = Html::element(
'a', [
741 'href' => $this->mSecureLoginUrl,
742 'class' =>
'mw-ui-flush-right mw-secure',
743 ], $this->
msg(
'userlogin-signwithsecure' )->text() );
745 $usernameHelpLink =
'';
746 if ( !$this->
msg(
'createacct-helpusername' )->isDisabled() ) {
747 $usernameHelpLink = Html::rawElement(
'span', [
748 'class' =>
'mw-ui-flush-right',
749 ], $this->
msg(
'createacct-helpusername' )->parse() );
753 $fieldDefinitions = [
759 'default' => Html::element(
'div', [
'id' =>
'mw-createacct-status-area' ] ),
763 'label-raw' => $this->
msg(
'userlogin-yourname' )->escaped() . $usernameHelpLink,
765 'placeholder-message' => $isLoggedIn ?
'createacct-another-username-ph'
766 :
'userlogin-yourname-ph',
771 'label-message' =>
'createaccountmail',
772 'name' =>
'wpCreateaccountMail',
773 'id' =>
'wpCreateaccountMail',
776 'id' =>
'wpPassword2',
777 'autocomplete' =>
'new-password',
778 'placeholder-message' =>
'createacct-yourpassword-ph',
779 'help-message' =>
'createacct-useuniquepass',
780 'hide-if' => [
'===',
'wpCreateaccountMail',
'1' ],
784 'type' =>
'password',
785 'label-message' =>
'createacct-yourpasswordagain',
787 'cssclass' =>
'loginPassword',
789 'autocomplete' =>
'new-password',
790 'validation-callback' =>
function ( $value, $alldata ) {
791 if ( empty( $alldata[
'mailpassword'] ) && !empty( $alldata[
'password'] ) ) {
793 return $this->
msg(
'htmlform-required' );
794 } elseif ( $value !== $alldata[
'password'] ) {
795 return $this->
msg(
'badretype' );
800 'hide-if' => [
'===',
'wpCreateaccountMail',
'1' ],
801 'placeholder-message' =>
'createacct-yourpasswordagain-ph',
805 'label-message' => $wgEmailConfirmToEdit ?
'createacct-emailrequired'
806 :
'createacct-emailoptional',
808 'cssclass' =>
'loginText',
811 'autocomplete' =>
'email',
814 'validation-callback' =>
function ( $value, $alldata ) {
822 return $this->
msg(
'noemailtitle' );
823 } elseif ( !$value && !empty( $alldata[
'mailpassword'] ) ) {
825 return $this->
msg(
'noemailcreate' );
826 } elseif ( $value && !Sanitizer::validateEmail( $value ) ) {
827 return $this->
msg(
'invalidemailaddress' );
828 } elseif ( is_string( $value ) && strlen( $value ) > 255 ) {
829 return $this->
msg(
'changeemail-maxlength' );
833 'placeholder-message' =>
'createacct-' . $anotherPart .
'email-ph',
837 'help-message' => $isLoggedIn ?
'createacct-another-realname-tip'
838 :
'prefs-help-realname',
839 'label-message' =>
'createacct-realname',
840 'cssclass' =>
'loginText',
842 'id' =>
'wpRealName',
843 'autocomplete' =>
'name',
848 'label-message' =>
'createacct-reason',
849 'cssclass' =>
'loginText',
852 'validation-callback' =>
function ( $value, $alldata ) {
855 if ( $value && Sanitizer::validateEmail( $value ) ) {
856 if ( $this->reasonValidatorResult !==
null ) {
859 $this->reasonValidatorResult =
true;
860 $authManager = MediaWikiServices::getInstance()->getAuthManager();
861 if ( !$authManager->getAuthenticationSessionData(
'reason-retry',
false ) ) {
862 $authManager->setAuthenticationSessionData(
'reason-retry',
true );
863 $this->reasonValidatorResult = $this->
msg(
'createacct-reason-confirm' );
869 'placeholder-message' =>
'createacct-reason-ph',
874 'default' => $this->
msg(
'createacct-' . $anotherPart . $continuePart .
876 'name' =>
'wpCreateaccount',
877 'id' =>
'wpCreateaccount',
885 $passwordRequest = AuthenticationRequest::getRequestByClass( $this->authRequests,
886 PasswordAuthenticationRequest::class );
887 $changePassword = $passwordRequest && $passwordRequest->action == AuthManager::ACTION_CHANGE;
888 $fieldDefinitions = [
890 'label-raw' => $this->
msg(
'userlogin-yourname' )->escaped() . $secureLoginLink,
892 'placeholder-message' =>
'userlogin-yourname-ph',
896 'autocomplete' =>
'new-password',
897 'placeholder-message' =>
'createacct-yourpassword-ph',
898 'help-message' =>
'createacct-useuniquepass',
900 'id' =>
'wpPassword1',
901 'autocomplete' =>
'current-password',
902 'placeholder-message' =>
'userlogin-yourpassword-ph',
906 'type' =>
'password',
907 'autocomplete' =>
'new-password',
908 'placeholder-message' =>
'createacct-yourpasswordagain-ph',
914 'cssclass' =>
'mw-userlogin-rememberme',
915 'name' =>
'wpRemember',
916 'label-message' => $this->
msg(
'userlogin-remembermypassword' )
917 ->numParams( $expirationDays ),
918 'id' =>
'wpRemember',
923 'default' => $this->
msg(
'pt-login-' . $continuePart .
'button' )->text(),
924 'id' =>
'wpLoginAttempt',
930 'cssclass' =>
'mw-form-related-link-container mw-userlogin-help',
933 'default' => Html::element(
'a', [
934 'href' => Skin::makeInternalOrExternalUrl( $this->
msg(
'helplogin-url' )
935 ->inContentLanguage()
937 ], $this->
msg(
'userlogin-helplink2' )->text() ),
948 $fieldDefinitions[
'username'] += [
951 'cssclass' =>
'loginText',
953 'autocomplete' =>
'username',
956 $fieldDefinitions[
'password'] += [
957 'type' =>
'password',
959 'name' =>
'wpPassword',
960 'cssclass' =>
'loginPassword',
965 if ( $this->mEntryError ) {
966 $fieldDefinitions[
'entryError'] = [
968 'default' => Html::rawElement(
'div', [
'class' => $this->mEntryErrorType .
'box', ],
969 $this->mEntryError ),
976 unset( $fieldDefinitions[
'linkcontainer'], $fieldDefinitions[
'signupend'] );
981 $signupendMsg = $this->
msg(
'signupend' );
982 $signupendHttpsMsg = $this->
msg(
'signupend-https' );
983 if ( !$signupendMsg->isDisabled() ) {
984 $usingHTTPS = $this->
getRequest()->getProtocol() ===
'https';
985 $signupendText = ( $usingHTTPS && !$signupendHttpsMsg->isBlank() )
986 ? $signupendHttpsMsg->parse() : $signupendMsg->parse();
987 $fieldDefinitions[
'signupend'] = [
990 'default' => Html::rawElement(
'div', [
'id' =>
'signupend' ], $signupendText ),
996 $passwordReset = MediaWikiServices::getInstance()->getPasswordReset();
997 if ( $passwordReset->isAllowed( $this->getUser() )->isGood() ) {
998 $fieldDefinitions[
'passwordReset'] = [
1001 'cssclass' =>
'mw-form-related-link-container',
1004 $this->
msg(
'userlogin-resetpassword-link' )->text()
1016 if ( $this->mLanguage ) {
1017 $linkq .=
'&uselang=' . urlencode( $this->mLanguage );
1019 $loggedIn = $this->
getUser()->isLoggedIn();
1021 $fieldDefinitions[
'createOrLogin'] = [
1024 'linkQuery' => $linkq,
1025 'default' =>
function ( $params ) use ( $loggedIn, $linkTitle ) {
1026 return Html::rawElement(
'div',
1027 [
'id' =>
'mw-createaccount' . ( !$loggedIn ?
'-cta' :
'' ),
1028 'class' => ( $loggedIn ?
'mw-form-related-link-container' :
'mw-ui-vform-field' ) ],
1029 ( $loggedIn ?
'' : $this->
msg(
'userlogin-noaccount' )->escaped() )
1030 . Html::element(
'a',
1032 'id' =>
'mw-createaccount-join' . ( $loggedIn ?
'-loggedin' :
'' ),
1033 'href' => $linkTitle->getLocalURL( $params[
'linkQuery'] ),
1034 'class' => ( $loggedIn ?
'' :
'mw-ui-button' ),
1038 $loggedIn ?
'userlogin-createanother' :
'userlogin-joinproject'
1048 return $fieldDefinitions;
1076 if ( $this->mReturnTo !==
'' ) {
1077 $returnto =
'returnto=' .
wfUrlencode( $this->mReturnTo );
1078 if ( $this->mReturnToQuery !==
'' ) {
1079 $returnto .=
'&returntoquery=' .
wfUrlencode( $this->mReturnToQuery );
1093 } elseif ( MediaWikiServices::getInstance()
1095 ->userHasRight( $this->
getUser(),
'createaccount' )
1104 return $this->
isSignup() ?
'wpCreateaccountToken' :
'wpLoginToken';
1114 $msg = $this->
msg(
'loginlanguagelinks' )->inContentLanguage();
1115 if ( $msg->isBlank() ) {
1118 $langs = explode(
"\n", $msg->text() );
1120 foreach ( $langs as
$lang ) {
1122 $parts = explode(
'|',
$lang );
1123 if ( count( $parts ) >= 2 ) {
1128 return count( $links ) > 0 ? $this->
msg(
'loginlanguagelabel' )->rawParams(
1129 $this->
getLanguage()->pipeList( $links ) )->escaped() :
'';
1143 return htmlspecialchars( $text );
1145 $query = [
'uselang' =>
$lang ];
1146 if ( $this->mReturnTo !==
'' ) {
1152 $targetLanguage = MediaWikiServices::getInstance()->getLanguageFactory()
1153 ->getLanguage(
$lang );
1154 $attr[
'lang'] = $attr[
'hreflang'] = $targetLanguage->getHtmlCode();
1175 isset( $formDescriptor[
'username'] ) &&
1176 !isset( $formDescriptor[
'username'][
'default'] ) &&
1180 if ( $user->isLoggedIn() ) {
1181 $formDescriptor[
'username'][
'default'] = $user->getName();
1183 $formDescriptor[
'username'][
'default'] =
1184 $this->
getRequest()->getSession()->suggestLoginUsername();
1191 unset( $formDescriptor[
'createaccount'], $formDescriptor[
'loginattempt'] );
1198 isset( $formDescriptor[
'username'] )
1199 && empty( $formDescriptor[
'username'][
'default'] )
1200 && !$this->
getRequest()->getCheck(
'wpName' )
1202 $formDescriptor[
'username'][
'autofocus'] =
true;
1203 } elseif ( isset( $formDescriptor[
'password'] ) ) {
1204 $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,...
wfCanIPUseHTTPS( $ip)
Determine whether the client at a given source IP is likely to be able to access the wiki via HTTPS.
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,...
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.
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...
beforeExecute( $subPage)
Stable to override.
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,...
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.
The User object encapsulates all of the user-specific settings (user_id, name, rights,...
static newFromName( $name, $validate='valid')
Static factory method for creation from username.
if(!isset( $args[0])) $lang