MediaWiki  1.30.0
LoginHelper Class Reference

Helper functions for the login form that need to be shared with other special pages (such as CentralAuth's SpecialCentralLogin). More...

Inheritance diagram for LoginHelper:
Collaboration diagram for LoginHelper:

Public Member Functions

 __construct (IContextSource $context)
 
 showReturnToPage ( $type, $returnTo='', $returnToQuery='', $stickHTTPS=false)
 Show a return link or redirect to it. More...
 
- Public Member Functions inherited from ContextSource
 canUseWikiPage ()
 Check whether a WikiPage object can be get with getWikiPage(). More...
 
 exportSession ()
 Export the resolved user IP, HTTP headers, user ID, and session ID. More...
 
 getConfig ()
 Get the Config object. More...
 
 getContext ()
 Get the base IContextSource object. More...
 
 getLanguage ()
 Get the Language object. More...
 
 getOutput ()
 Get the OutputPage object. More...
 
 getRequest ()
 Get the WebRequest object. More...
 
 getSkin ()
 Get the Skin object. More...
 
 getStats ()
 Get the Stats object. More...
 
 getTiming ()
 Get the Timing object. More...
 
 getTitle ()
 Get the Title object. More...
 
 getUser ()
 Get the User object. More...
 
 getWikiPage ()
 Get the WikiPage object. More...
 
 msg ( $key)
 Get a Message object with context set Parameters are the same as wfMessage() More...
 
 setContext (IContextSource $context)
 Set the IContextSource object. More...
 

Static Public Member Functions

static getValidErrorMessages ()
 Returns an array of all valid error messages. More...
 

Static Public Attributes

static string[] $validErrorMessages
 Valid error and warning messages. More...
 

Detailed Description

Helper functions for the login form that need to be shared with other special pages (such as CentralAuth's SpecialCentralLogin).

Since
1.27

Definition at line 8 of file LoginHelper.php.

Constructor & Destructor Documentation

◆ __construct()

LoginHelper::__construct ( IContextSource  $context)

Definition at line 46 of file LoginHelper.php.

References ContextSource\setContext().

Member Function Documentation

◆ getValidErrorMessages()

static LoginHelper::getValidErrorMessages ( )
static

Returns an array of all valid error messages.

Returns
array
See also
LoginHelper::$validErrorMessages

Definition at line 36 of file LoginHelper.php.

References $messages, $validErrorMessages, and Hooks\run().

Referenced by LoginForm\getValidErrorMessages(), LoginSignupSpecialPage\load(), and UserNotLoggedIn\report().

◆ showReturnToPage()

LoginHelper::showReturnToPage (   $type,
  $returnTo = '',
  $returnToQuery = '',
  $stickHTTPS = false 
)

Show a return link or redirect to it.

Extensions can change where the link should point or inject content into the page (which will change it from redirect to link mode).

Parameters
string$typeOne of the following:
  • error: display a return to link ignoring $wgRedirectOnLogin
  • success: display a return to link using $wgRedirectOnLogin if needed
  • successredirect: send an HTTP redirect using $wgRedirectOnLogin if needed
string$returnTo
array | string$returnToQuery
bool$stickHTTPSKeep redirect link on HTTPS

Definition at line 63 of file LoginHelper.php.

References $options, $type, $wgRedirectOnLogin, $wgSecureLogin, ContextSource\getOutput(), global, Title\newFromText(), Title\newMainPage(), PROTO_HTTP, PROTO_HTTPS, PROTO_RELATIVE, Hooks\run(), and wfCgiToArray().

Member Data Documentation

◆ $validErrorMessages

string [] LoginHelper::$validErrorMessages
static
Initial value:
= [
'exception-nologin-text',
'watchlistanontext',
'changeemail-no-info',
'resetpass-no-info',
'confirmemail_needlogin',
'prefsnologintext2',
]

Valid error and warning messages.

Special:Userlogin can show an error or warning message on the form when coming from another page. This is done via the ?error= or ?warning= GET parameters.

This array is the list of valid message keys. Further keys can be added by the LoginFormValidErrorMessages hook. All other values will be ignored.

Definition at line 21 of file LoginHelper.php.

Referenced by getValidErrorMessages().


The documentation for this class was generated from the following file: