8use MediaWiki\HookContainer\ProtectedHookAccessorTrait;
19 use ProtectedHookAccessorTrait;
24 private static $validErrorMessages = [
25 'exception-nologin-text',
26 'exception-nologin-text-for-temp-user',
28 'watchlistanontext-for-temp-user',
29 'watchlistlabels-not-logged-in',
30 'watchlistlabels-not-logged-in-for-temp-user',
31 'changeemail-no-info',
32 'confirmemail_needlogin',
34 'prefsnologintext2-for-temp-user',
35 'specialmute-login-required',
36 'specialmute-login-required-for-temp-user',
41 private static ?array $validErrorMessagesCache =
null;
57 if ( !static::$validErrorMessagesCache ) {
58 static::$validErrorMessagesCache = self::$validErrorMessages;
60 ->onLoginFormValidErrorMessages( static::$validErrorMessagesCache );
63 return static::$validErrorMessagesCache;
67 $this->setContext( $context );
89 $type, $returnTo =
'', $returnToQuery =
'', $stickHTTPS =
false, $returnToAnchor =
''
91 $config = $this->getConfig();
95 } elseif ( is_string( $returnToQuery ) ) {
98 if ( $returnToAnchor !==
'' && $returnToAnchor[0] !==
'#' ) {
103 $oldReturnTo = $returnTo;
104 $oldReturnToQuery = $returnToQuery;
105 $this->getHookRunner()->onPostLoginRedirect( $returnTo, $returnToQuery, $type );
106 if ( $returnTo !== $oldReturnTo || $returnToQuery !== $oldReturnToQuery ) {
109 $returnToAnchor =
'';
112 $returnToTitle = Title::newFromText( $returnTo ) ?: Title::newMainPage();
117 $options = [
'https' ];
120 $options = [
'http' ];
127 if ( $type ===
'successredirect' ) {
128 $redirectUrl = $returnToTitle->getFullUrlForRedirect( $returnToQuery, $proto )
130 $this->getOutput()->redirect( $redirectUrl );
132 $this->getOutput()->addReturnTo( $returnToTitle, $returnToQuery,
null, $options );
138class_alias( LoginHelper::class,
'LoginHelper' );
wfCgiToArray( $query)
This is the logical opposite of wfArrayToCgi(): it accepts a query string as its argument and returns...
if(!defined('MW_SETUP_CALLBACK'))
The simplest way of implementing IContextSource is to hold a RequestContext as a member variable and ...
A class containing constants representing the names of configuration variables.
const ForceHTTPS
Name constant for the ForceHTTPS setting, for use with Config::get()
const RedirectOnLogin
Name constant for the RedirectOnLogin setting, for use with Config::get()
const SecureLogin
Name constant for the SecureLogin setting, for use with Config::get()
Interface for objects which can provide a MediaWiki context on request.