MediaWiki master
MediaWiki\Specials\Helpers\LoginHelper Class Reference

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

Inherits MediaWiki\Context\ContextSource.

Collaboration diagram for MediaWiki\Specials\Helpers\LoginHelper:

Public Member Functions

 __construct (IContextSource $context)
 
 showReturnToPage ( $type, $returnTo='', $returnToQuery='', $stickHTTPS=false, $returnToAnchor='')
 Show a return link or redirect to it.
 
- Public Member Functions inherited from MediaWiki\Context\ContextSource
 canUseWikiPage ()
 Check whether a WikiPage object can be get with getWikiPage().
 
 exportSession ()
 Export the resolved user IP, HTTP headers, user ID, and session ID.
 
 getActionName ()
 Get the action name for the current web request.
 
 getAuthority ()
 
 getConfig ()
 
 getContext ()
 Get the base IContextSource object.
 
 getCsrfTokenSet ()
 Get a repository to obtain and match CSRF tokens.
 
 getLanguage ()
 
 getLanguageCode ()
 
 getOutput ()
 
 getRequest ()
 
 getSkin ()
 
 getTiming ()
 
 getTitle ()
 
 getUser ()
 
 getWikiPage ()
 Get the WikiPage object.
 
 msg ( $key,... $params)
 Get a Message object with context set Parameters are the same as wfMessage()
 
 setContext (IContextSource $context)
 

Static Public Member Functions

static getValidErrorMessages ()
 Returns an array of all error and warning messages that can be displayed on Special:UserLogin or Special:CreateAccount through the ?error or ?warning GET parameters.
 

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 18 of file LoginHelper.php.

Constructor & Destructor Documentation

◆ __construct()

MediaWiki\Specials\Helpers\LoginHelper::__construct ( IContextSource $context)

Definition at line 66 of file LoginHelper.php.

Member Function Documentation

◆ getValidErrorMessages()

static MediaWiki\Specials\Helpers\LoginHelper::getValidErrorMessages ( )
static

Returns an array of all error and warning messages that can be displayed on Special:UserLogin or Special:CreateAccount through the ?error or ?warning GET parameters.

Special:UserLogin and Special:CreateAccount can show an error or warning message on the form when coming from another page using the aforementioned GET parameters.

Further keys can be added by the LoginFormValidErrorMessages hook. If a message key is not in this list, then no redirect will be performed to Special:UserLogin or Special:CreateAccount.

Returns
string[]
See also
LoginHelper::$validErrorMessages

Definition at line 56 of file LoginHelper.php.

References MediaWiki\MediaWikiServices\getInstance().

Referenced by MediaWiki\Exception\UserNotLoggedIn\report().

◆ showReturnToPage()

MediaWiki\Specials\Helpers\LoginHelper::showReturnToPage ( $type,
$returnTo = '',
$returnToQuery = '',
$stickHTTPS = false,
$returnToAnchor = '' )

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
  • signup: used during signup, functionally identical to 'success'
string$returnToTitle of page to return to. Overriden by $wgRedirectOnLogin when that is set (and $type is not 'error').
array | string$returnToQueryQuery parameters to return to.
bool$stickHTTPSKeep redirect link on HTTPS. Ignored (treated as true) if $wgForceHTTPS is true.
string$returnToAnchorA string to append to the URL, presumed to be either a fragment including the leading hash or an empty string.

Definition at line 88 of file LoginHelper.php.

References MediaWiki\MainConfigNames\ForceHTTPS, PROTO_HTTP, PROTO_HTTPS, PROTO_RELATIVE, MediaWiki\MainConfigNames\RedirectOnLogin, MediaWiki\MainConfigNames\SecureLogin, and wfCgiToArray().


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