35 AuthManager::ACTION_LOGIN,
36 AuthManager::ACTION_LOGIN_CONTINUE
40 'authform-newtoken' =>
'nocookiesforlogin',
41 'authform-notoken' =>
'sessionfailure',
42 'authform-wrongtoken' =>
'sessionfailure',
49 parent::__construct(
'Userlogin' );
62 return AuthManager::ACTION_LOGIN;
66 return $this->
msg(
'login' )->text();
72 if ( $this->securityLevel && $this->
getUser()->isRegistered() ) {
73 $this->
getOutput()->setPageTitle( $this->
msg(
'login-security' ) );
85 $query = array_diff_key( $this->
getRequest()->getValues(),
86 array_fill_keys( [
'type',
'title' ],
true ) );
91 return parent::beforeExecute(
$subPage );
106 $secureLogin = $this->
getConfig()->get( MainConfigNames::SecureLogin );
108 $user = $this->targetUser ?: $this->
getUser();
116 if ( $user->requiresHTTPS() ) {
117 $this->mStickHTTPS =
true;
119 $session->setForceHTTPS( $secureLogin && $this->mStickHTTPS );
124 $this->
mainLoginForm( [ ], $session->getProvider()->whyNoSession() );
130 # Run any hooks; display injected HTML if any, else redirect
133 $user, $injected_html, $direct );
135 if ( $injected_html !==
'' || $extraMessages ) {
137 'loginsuccess', $injected_html, $extraMessages );
140 $helper->showReturnToPage(
'successredirect', $this->mReturnTo, $this->mReturnToQuery,
141 $this->mStickHTTPS );
146 return $this->
getRequest()->getSession()->getToken(
'',
'login' );
150 return $this->
getRequest()->getSession()->resetToken(
'login' );
154 return 'wpLoginToken';
162 LoggerFactory::getInstance(
'authevents' )->info(
'Login attempt', [
165 'status' => strval( $status ),
string $subPage
Subpage of the special page.
getRequest()
Get the WebRequest being used for this instance.
Helper functions for the login form that need to be shared with other special pages (such as CentralA...
Holds shared logic for login and account creation pages.
mainLoginForm(array $requests, $msg='', $msgtype='error')
showSuccessPage( $type, $title, $msgname, $injected_html, $extraMessages)
Show the success page.
hasSessionCookie()
Check if a session cookie is present.
A class containing constants representing the names of configuration variables.
getOutput()
Get the OutputPage being used for this instance.
getUser()
Shortcut to get the User executing this instance.
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.
setAuthManager(AuthManager $authManager)
Set the injected AuthManager from the special page constructor.
Implements Special:UserLogin.
getDescription()
Returns the name that goes in the <h1> in the special page itself, and also the name that will be l...
getGroupName()
Under which header this special page is listed in Special:SpecialPages See messages 'specialpages-gro...
getDefaultAction( $subPage)
Get the default action for this special page, if none is given via URL/POST data.
logAuthResult( $success, $status=null)
Logs to the authmanager-stats channel.
setHeaders()
Sets headers - this should be called from the execute() method of all derived classes!
getTokenName()
Returns the name of the CSRF token (under which it should be found in the POST or GET data).
__construct(AuthManager $authManager)
successfulAction( $direct=false, $extraMessages=null)
Run any hooks registered for logins, then HTTP redirect to $this->mReturnTo (or Main Page if that's u...
doesWrites()
Indicates whether this special page may perform database writes.
getToken()
Returns the CSRF token.