42 AuthManager::ACTION_LOGIN,
43 AuthManager::ACTION_LOGIN_CONTINUE
48 'authform-newtoken' =>
'nocookiesforlogin',
49 'authform-notoken' =>
'sessionfailure',
50 'authform-wrongtoken' =>
'sessionfailure',
59 parent::__construct(
'Userlogin' );
61 $this->identityUtils = $identityUtils;
77 return AuthManager::ACTION_LOGIN;
81 return $this->
msg(
'login' );
87 if ( $this->securityLevel && $this->
getUser()->isRegistered() ) {
88 $this->
getOutput()->setPageTitleMsg( $this->
msg(
'login-security' ) );
100 $query = array_diff_key( $this->
getRequest()->getQueryValues(),
101 array_fill_keys( [
'type',
'title' ],
true ) );
106 return parent::beforeExecute(
$subPage );
123 $user = $this->targetUser ?: $this->
getUser();
132 if ( $user->requiresHTTPS() ) {
133 $this->mStickHTTPS =
true;
135 $session->setForceHTTPS( $secureLogin && $this->mStickHTTPS );
140 $this->
mainLoginForm( [ ], $session->getProvider()->whyNoSession() );
145 # Run any hooks; display injected HTML if any, else redirect
147 $user, $injected_html, $direct );
150 if ( $injected_html !==
'' || $extraMessages ) {
152 'loginsuccess', $injected_html, $extraMessages );
155 $helper->showReturnToPage(
'successredirect', $this->mReturnTo, $this->mReturnToQuery,
156 $this->mStickHTTPS, $this->mReturnToAnchor );
161 return $this->
getRequest()->getSession()->getToken(
'',
'login' );
165 $this->
getRequest()->getSession()->resetToken(
'login' );
169 return 'wpLoginToken';
177 LoggerFactory::getInstance(
'authevents' )->info(
'Login attempt', [
180 'accountType' => $this->identityUtils->getShortUserTypeInternal( $performer ),
181 'status' => strval( $status ),
190class_alias( SpecialUserLogin::class,
'SpecialUserLogin' );
Helper functions for the login form that need to be shared with other special pages (such as CentralA...
A class containing constants representing the names of configuration variables.
const SecureLogin
Name constant for the SecureLogin setting, for use with Config::get()
string $subPage
Subpage of the special page.
getRequest()
Get the WebRequest being used for this instance.
Holds shared logic for login and account creation pages.
showSuccessPage( $type, $title, $msgname, $injected_html, $extraMessages)
Show the success page.
mainLoginForm(array $requests, $msg='', $msgtype='error')
hasSessionCookie()
Check if a session cookie is present.
Parent class for all special pages.
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,...
getUser()
Shortcut to get the User executing this instance.
setAuthManager(AuthManager $authManager)
Set the injected AuthManager from the special page constructor.
getConfig()
Shortcut to get main config object.
getContext()
Gets the context this SpecialPage is executed in.
msg( $key,... $params)
Wrapper around wfMessage that sets the current context.
getOutput()
Get the OutputPage being used for this instance.
Generic operation result class Has warning/error list, boolean status and arbitrary value.