MediaWiki  REL1_24
LoginForm Class Reference

Implements Special:UserLogin. More...

Inheritance diagram for LoginForm:
Collaboration diagram for LoginForm:

List of all members.

Public Member Functions

 __construct ($request=null)
 addNewAccount ()
 addNewAccountInternal ()
 Make a new user account using the loaded data.
 addNewAccountMailPassword ()
 attemptAutoCreate ($user)
 Attempt to automatically create a user on login.
 authenticateUserData ()
 Internally authenticate the login request.
 cookieRedirectCheck ($type)
 execute ($subPage)
 getDescription ()
 Returns the name that goes in the <h1> in the special page itself, and also the name that will be listed in Special:Specialpages.
 hasSessionCookie ()
 Check if a session cookie is present.
 initUser ($u, $autocreate)
 Actually add a user to the database.
 load ()
 Loader.
 mailPasswordInternal ($u, $throttle=true, $emailTitle= 'passwordremindertitle', $emailText= 'passwordremindertext')
 makeLanguageSelector ()
 Produce a bar of links which allow the user to select another language during login/registration but retain "returnto".
 makeLanguageSelectorLink ($text, $lang)
 Create a language selector link for a particular language Links back to this page preserving type and returnto.
 onCookieRedirectCheck ($type)
 processLogin ()
 showReturnToPage ($type, $returnTo= '', $returnToQuery= '', $stickHTTPs=false)
 Add a "return to" link or redirect to it.
 userBlockedMessage (Block $block)
 Output a message that informs the user that they cannot create an account because there is a block on them or their IP which prevents account creation.

Static Public Member Functions

static clearCreateaccountToken ()
 Remove any createaccount token attached to the current session.
static clearLoginThrottle ($username)
 Clear the login attempt throttle hit count for the (username,current IP) tuple.
static clearLoginToken ()
 Remove any login token attached to the current session.
static getCreateaccountToken ()
 Get the createaccount token from the current session.
static getLoginToken ()
 Get the login token from the current session.
static incLoginThrottle ($username)
 Increment the login attempt throttle hit count for the (username,current IP) tuple unless the throttle was already reached.
static setCreateaccountToken ()
 Randomly generate a new createaccount token and attach it to the current session.
static setLoginToken ()
 Randomly generate a new login token and attach it to the current session.

Public Attributes

 $mAbortLoginErrorMsg = null
const ABORTED = 8
const CREATE_BLOCKED = 9
const EMPTY_PASS = 6
const ILLEGAL = 2
const NEED_TOKEN = 12
const NO_NAME = 1
const NOT_EXISTS = 4
const RESET_PASS = 7
const SUCCESS = 0
const THROTTLED = 10
const USER_BLOCKED = 11
const USER_MIGRATED = 14
const WRONG_PASS = 5
const WRONG_PLUGIN_PASS = 3
const WRONG_TOKEN = 13

Static Public Attributes

static $validErrorMessages

Protected Member Functions

 getGroupName ()
 Under which header this special page is listed in Special:SpecialPages See messages 'specialpages-group-*' for valid names This method defaults to group 'other'.
 resetLoginForm (Message $msg)
 Show the Special:ChangePassword form, with custom message.

Protected Attributes

 $mAction
 $mCookieCheck
 $mCreateaccount
 $mCreateaccountMail
 $mDomain
 $mEmail
 $mEntryError = ''
 $mEntryErrorType = 'error'
 $mLanguage
 $mLoginattempt
 $mPassword
 $mPosted
 $mRealName
 $mReason
 $mRemember
 $mReturnTo
 $mReturnToQuery
 $mRetype
 $mSkipCookieCheck
 $mStickHTTPS
 $mToken
 $mType
 $mUsername

Private Member Functions

 displaySuccessfulAction ($type, $title, $msgname, $injected_html)
 Display a "successful action" page.
 executeReturnTo ($type)
 Add a "return to" link or redirect to it.
 mainLoginForm ($msg, $msgtype= 'error')
 renewSessionId ()
 Renew the user's session id, using strong entropy.
 showCreateOrLoginLink (&$user)
 Whether the login/create account form should display a link to the other form (in addition to whatever the skin provides).
 successfulCreation ()
 Run any hooks registered for logins, then display a message welcoming the user.
 successfulLogin ()
 Run any hooks registered for logins, then HTTP redirect to $this->mReturnTo (or Main Page if that's undefined).

Private Attributes

 $mLoaded = false
WebRequest $mOverrideRequest = null
 *
WebRequest $mRequest = null
 Effective request; set at the beginning of load *.
 $mSecureLoginUrl
 $mTempPasswordUsed

Detailed Description

Implements Special:UserLogin.

Definition at line 29 of file SpecialUserlogin.php.


Constructor & Destructor Documentation

LoginForm::__construct ( request = null)
Parameters:
WebRequest$request

Definition at line 105 of file SpecialUserlogin.php.


Member Function Documentation

Access:
private
Returns:
bool

Definition at line 352 of file SpecialUserlogin.php.

Make a new user account using the loaded data.

Exceptions:
PermissionsError|ReadOnlyError
Returns:
Status

Definition at line 434 of file SpecialUserlogin.php.

Access:
private

Definition at line 312 of file SpecialUserlogin.php.

Attempt to automatically create a user on login.

Only succeeds if there is an external authentication method which allows it.

Parameters:
User$user
Returns:
int Status code

Definition at line 855 of file SpecialUserlogin.php.

Internally authenticate the login request.

This may create a local account as a side effect if the authentication plugin allows transparent local account creation.

Returns:
int

Definition at line 659 of file SpecialUserlogin.php.

Remove any createaccount token attached to the current session.

Definition at line 1534 of file SpecialUserlogin.php.

static LoginForm::clearLoginThrottle ( username) [static]

Clear the login attempt throttle hit count for the (username,current IP) tuple.

Parameters:
string$usernameThe user name
Returns:
void

Definition at line 839 of file SpecialUserlogin.php.

Referenced by SpecialChangePassword\attemptReset().

static LoginForm::clearLoginToken ( ) [static]

Remove any login token attached to the current session.

Definition at line 1508 of file SpecialUserlogin.php.

Parameters:
string$type
Access:
private

Definition at line 1555 of file SpecialUserlogin.php.

LoginForm::displaySuccessfulAction ( type,
title,
msgname,
injected_html 
) [private]

Display a "successful action" page.

Parameters:
string$typeCondition of return to; see `executeReturnTo`
string | Message$titlePage's title
string$msgname
string$injected_html

Definition at line 1144 of file SpecialUserlogin.php.

LoginForm::execute ( subPage)
Parameters:
string | null$subPage

Reimplemented from SpecialPage.

Definition at line 225 of file SpecialUserlogin.php.

LoginForm::executeReturnTo ( type) [private]

Add a "return to" link or redirect to it.

Parameters:
string$typeOne of the following:
  • error: display a return to link ignoring $wgRedirectOnLogin
  • signup: display a return to link using $wgRedirectOnLogin if needed
  • success: display a return to link using $wgRedirectOnLogin if needed
  • successredirect: send an HTTP redirect using $wgRedirectOnLogin if needed

Definition at line 1225 of file SpecialUserlogin.php.

Returns the name that goes in the <h1> in the special page itself, and also the name that will be listed in Special:Specialpages.

Derived classes can override this, but usually it is easier to keep the default behavior.

Returns:
string

Reimplemented from SpecialPage.

Definition at line 214 of file SpecialUserlogin.php.

LoginForm::getGroupName ( ) [protected]

Under which header this special page is listed in Special:SpecialPages See messages 'specialpages-group-*' for valid names This method defaults to group 'other'.

Returns:
string
Since:
1.21

Reimplemented from SpecialPage.

Definition at line 1646 of file SpecialUserlogin.php.

static LoginForm::getLoginToken ( ) [static]

Get the login token from the current session.

Returns:
mixed

Definition at line 1489 of file SpecialUserlogin.php.

Referenced by SpecialChangePassword\getFormFields(), SpecialChangePassword\onSubmit(), and SpecialChangePassword\onSuccess().

Check if a session cookie is present.

This will not pick up a cookie set during _this_ request, but is meant to ensure that the client is returning the cookie which was set on a previous pass through the system.

Access:
private
Returns:
bool

Definition at line 1479 of file SpecialUserlogin.php.

static LoginForm::incLoginThrottle ( username) [static]

Increment the login attempt throttle hit count for the (username,current IP) tuple unless the throttle was already reached.

Parameters:
string$usernameThe user name
Returns:
bool|int The integer hit count or True if it is already at the limit

Definition at line 811 of file SpecialUserlogin.php.

Referenced by SpecialChangePassword\attemptReset().

LoginForm::initUser ( u,
autocreate 
)

Actually add a user to the database.

Give it a User object that has been initialised with a name.

Parameters:
User$u
bool$autocreateTrue if this is an autocreation via auth plugin
Returns:
Status Status object, with the User object in the value member on success
Access:
private

Definition at line 622 of file SpecialUserlogin.php.

Loader.

Definition at line 114 of file SpecialUserlogin.php.

LoginForm::mailPasswordInternal ( u,
throttle = true,
emailTitle = 'passwordremindertitle',
emailText = 'passwordremindertext' 
)
Parameters:
User$u
bool$throttle
string$emailTitleMessage name of email title
string$emailTextMessage name of email text
Returns:
Status

Definition at line 1053 of file SpecialUserlogin.php.

LoginForm::mainLoginForm ( msg,
msgtype = 'error' 
) [private]
Parameters:
string$msg
string$msgtype

Definition at line 1268 of file SpecialUserlogin.php.

Produce a bar of links which allow the user to select another language during login/registration but retain "returnto".

Returns:
string

Definition at line 1592 of file SpecialUserlogin.php.

LoginForm::makeLanguageSelectorLink ( text,
lang 
)

Create a language selector link for a particular language Links back to this page preserving type and returnto.

Parameters:
string$textLink text
string$langLanguage code
Returns:
string

Definition at line 1620 of file SpecialUserlogin.php.

Parameters:
string$type
Access:
private

Definition at line 1571 of file SpecialUserlogin.php.

Definition at line 902 of file SpecialUserlogin.php.

Renew the user's session id, using strong entropy.

Definition at line 1542 of file SpecialUserlogin.php.

LoginForm::resetLoginForm ( Message msg) [protected]

Show the Special:ChangePassword form, with custom message.

Parameters:
Message$msg

Definition at line 1032 of file SpecialUserlogin.php.

static LoginForm::setCreateaccountToken ( ) [static]

Randomly generate a new createaccount token and attach it to the current session.

Definition at line 1526 of file SpecialUserlogin.php.

Referenced by ApiCreateAccountTest\setUp().

static LoginForm::setLoginToken ( ) [static]

Randomly generate a new login token and attach it to the current session.

Definition at line 1498 of file SpecialUserlogin.php.

Referenced by SpecialChangePassword\getFormFields(), and SpecialChangePassword\onSuccess().

LoginForm::showCreateOrLoginLink ( &$  user) [private]

Whether the login/create account form should display a link to the other form (in addition to whatever the skin provides).

Parameters:
User$user
Returns:
bool

Definition at line 1459 of file SpecialUserlogin.php.

LoginForm::showReturnToPage ( type,
returnTo = '',
returnToQuery = '',
stickHTTPs = false 
)

Add a "return to" link or redirect to it.

Extensions can use this to reuse the "return to" logic after inject steps (such as redirection) into the login process.

Parameters:
string$typeOne of the following:
  • error: display a return to link ignoring $wgRedirectOnLogin
  • signup: display a return to link using $wgRedirectOnLogin if needed
  • 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
Since:
1.22

Definition at line 1207 of file SpecialUserlogin.php.

Run any hooks registered for logins, then display a message welcoming the user.

Definition at line 1114 of file SpecialUserlogin.php.

Run any hooks registered for logins, then HTTP redirect to $this->mReturnTo (or Main Page if that's undefined).

Formerly we had a nice message here, but that's really not as useful as just being sent to wherever you logged in from. It should be clear that the action was successful, given the lack of error messages plus the appearance of your name in the upper right.

Definition at line 1094 of file SpecialUserlogin.php.

Output a message that informs the user that they cannot create an account because there is a block on them or their IP which prevents account creation.

Note that User::isBlockedFromCreateAccount(), which gets this block, ignores the 'hardblock' setting on blocks (bug 13611).

Parameters:
Block$blockThe block causing this error
Exceptions:
ErrorPageError

Definition at line 1164 of file SpecialUserlogin.php.


Member Data Documentation

LoginForm::$mAbortLoginErrorMsg = null

Definition at line 68 of file SpecialUserlogin.php.

LoginForm::$mAction [protected]

Definition at line 76 of file SpecialUserlogin.php.

LoginForm::$mCookieCheck [protected]

Definition at line 74 of file SpecialUserlogin.php.

LoginForm::$mCreateaccount [protected]

Definition at line 77 of file SpecialUserlogin.php.

LoginForm::$mCreateaccountMail [protected]

Definition at line 78 of file SpecialUserlogin.php.

LoginForm::$mDomain [protected]

Definition at line 82 of file SpecialUserlogin.php.

LoginForm::$mEmail [protected]

Definition at line 81 of file SpecialUserlogin.php.

LoginForm::$mEntryError = '' [protected]

Definition at line 91 of file SpecialUserlogin.php.

LoginForm::$mEntryErrorType = 'error' [protected]

Definition at line 92 of file SpecialUserlogin.php.

LoginForm::$mLanguage [protected]

Definition at line 83 of file SpecialUserlogin.php.

LoginForm::$mLoaded = false [private]

Definition at line 95 of file SpecialUserlogin.php.

LoginForm::$mLoginattempt [protected]

Definition at line 79 of file SpecialUserlogin.php.

WebRequest LoginForm::$mOverrideRequest = null [private]

*

Definition at line 98 of file SpecialUserlogin.php.

LoginForm::$mPassword [protected]

Definition at line 71 of file SpecialUserlogin.php.

LoginForm::$mPosted [protected]

Definition at line 75 of file SpecialUserlogin.php.

LoginForm::$mRealName [protected]

Definition at line 90 of file SpecialUserlogin.php.

LoginForm::$mReason [protected]

Definition at line 89 of file SpecialUserlogin.php.

LoginForm::$mRemember [protected]

Definition at line 80 of file SpecialUserlogin.php.

WebRequest LoginForm::$mRequest = null [private]

Effective request; set at the beginning of load *.

Definition at line 100 of file SpecialUserlogin.php.

LoginForm::$mReturnTo [protected]

Definition at line 73 of file SpecialUserlogin.php.

LoginForm::$mReturnToQuery [protected]

Definition at line 85 of file SpecialUserlogin.php.

LoginForm::$mRetype [protected]

Definition at line 72 of file SpecialUserlogin.php.

LoginForm::$mSecureLoginUrl [private]

Definition at line 96 of file SpecialUserlogin.php.

LoginForm::$mSkipCookieCheck [protected]

Definition at line 84 of file SpecialUserlogin.php.

LoginForm::$mStickHTTPS [protected]

Definition at line 87 of file SpecialUserlogin.php.

LoginForm::$mTempPasswordUsed [private]

Definition at line 94 of file SpecialUserlogin.php.

LoginForm::$mToken [protected]

Definition at line 86 of file SpecialUserlogin.php.

LoginForm::$mType [protected]

Definition at line 88 of file SpecialUserlogin.php.

LoginForm::$mUsername [protected]

Definition at line 70 of file SpecialUserlogin.php.

LoginForm::$validErrorMessages [static]
Initial value:
 array(
        'exception-nologin-text',
        'watchlistanontext',
        'changeemail-no-info',
        'resetpass-no-info',
        'confirmemail_needlogin',
        'prefsnologintext2',
    )

Definition at line 59 of file SpecialUserlogin.php.

Referenced by UserNotLoggedIn\report().

const LoginForm::ABORTED = 8

Definition at line 38 of file SpecialUserlogin.php.

Referenced by ApiLogin\execute().

Definition at line 39 of file SpecialUserlogin.php.

Referenced by ApiLogin\execute().

Definition at line 36 of file SpecialUserlogin.php.

Referenced by ApiLogin\execute().

const LoginForm::ILLEGAL = 2

Definition at line 32 of file SpecialUserlogin.php.

Referenced by ApiLogin\execute().

Definition at line 42 of file SpecialUserlogin.php.

Referenced by ApiLogin\execute().

const LoginForm::NO_NAME = 1

Definition at line 31 of file SpecialUserlogin.php.

Referenced by ApiLogin\execute().

Definition at line 34 of file SpecialUserlogin.php.

Referenced by ApiLogin\execute().

Definition at line 37 of file SpecialUserlogin.php.

Referenced by ApiLogin\execute().

const LoginForm::SUCCESS = 0

Definition at line 30 of file SpecialUserlogin.php.

Referenced by ApiLogin\execute().

Definition at line 40 of file SpecialUserlogin.php.

Referenced by ApiLogin\execute().

Definition at line 41 of file SpecialUserlogin.php.

Referenced by ApiLogin\execute().

Definition at line 44 of file SpecialUserlogin.php.

Definition at line 35 of file SpecialUserlogin.php.

Referenced by ApiLogin\execute().

Definition at line 33 of file SpecialUserlogin.php.

Referenced by ApiLogin\execute().

Definition at line 43 of file SpecialUserlogin.php.

Referenced by ApiLogin\execute().


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