MediaWiki  REL1_21
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 ($par)
 Default execute method Checks user permissions, calls the function given in mFunction.
 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.
 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 ()
 resetLoginForm ($error)
 showCreateOrLoginLink (&$user)
 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 = 'login-abort-generic'
 $mAction
 $mCookieCheck
 $mCreateaccount
 $mCreateaccountMail
 $mDomain
 $mEmail
 $mLanguage
 $mLoginattempt
 $mPassword
 $mPosted
 $mRealName
 $mReason
 $mRemember
 $mReturnTo
 $mReturnToQuery
 $mRetype
 $mSkipCookieCheck
 $mStickHTTPS
 $mToken
 $mType
 $mUsername
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 WRONG_PASS = 5
const WRONG_PLUGIN_PASS = 3
const WRONG_TOKEN = 13

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'.

Private Member Functions

 displaySuccessfulAction ($title, $msgname, $injected_html)
 Display an "successful action" page.
 executeReturnTo ($type)
 Add a "return to" link or redirect to it.
 initUser ($u, $autocreate)
 Actually add a user to the database.
 mainLoginForm ($msg, $msgtype= 'error')
 renewSessionId ()
 Renew the user's session id, using strong entropy.
 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

ExternalUser $mExtUser = null
 $mLoaded = false
 $mOverrideRequest = null
 @ var WebRequest

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 66 of file SpecialUserlogin.php.


Member Function Documentation

Access:
private
Returns:
bool

Definition at line 231 of file SpecialUserlogin.php.

Referenced by execute().

Make a new user account using the loaded data.

Exceptions:
PermissionsError|ReadOnlyError
Returns:
Status

Definition at line 311 of file SpecialUserlogin.php.

Access:
private

Definition at line 193 of file SpecialUserlogin.php.

Referenced by execute().

Attempt to automatically create a user on login.

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

Parameters:
$userUser
Returns:
integer Status code

Definition at line 697 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 507 of file SpecialUserlogin.php.

Referenced by processLogin().

Remove any createaccount token attached to the current session.

Definition at line 1261 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 681 of file SpecialUserlogin.php.

Referenced by SpecialChangePassword\attemptReset().

static LoginForm::clearLoginToken ( ) [static]

Remove any login token attached to the current session.

Definition at line 1236 of file SpecialUserlogin.php.

Referenced by processLogin().

Access:
private

Definition at line 1292 of file SpecialUserlogin.php.

Referenced by processLogin().

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

Display an "successful action" page.

Parameters:
string | Message$titlepage's title
$msgnamestring
$injected_htmlstring

Definition at line 943 of file SpecialUserlogin.php.

LoginForm::execute ( subPage)

Default execute method Checks user permissions, calls the function given in mFunction.

This must be overridden by subclasses; it will be made abstract in a future version

Parameters:
$subPagestring|null

Reimplemented from SpecialPage.

Definition at line 143 of file SpecialUserlogin.php.

References $query, $title, $url, addNewAccount(), addNewAccountMailPassword(), array(), WebRequest\detectProtocol(), SpecialPage\getFullTitle(), SpecialPage\getOutput(), global, load(), mainLoginForm(), onCookieRedirectCheck(), processLogin(), SpecialPage\setHeaders(), Special, and wfSetupSession().

LoginForm::executeReturnTo ( type) [private]

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

Parameters:
$typestring, one 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

Definition at line 990 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. Messages can be added at run-time, see MessageCache.php.

Returns:
String

Reimplemented from SpecialPage.

Definition at line 138 of file SpecialUserlogin.php.

References SpecialPage\getUser(), and SpecialPage\msg().

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 1381 of file SpecialUserlogin.php.

static LoginForm::getLoginToken ( ) [static]

Get the login token from the current session.

Returns:
Mixed

Definition at line 1218 of file SpecialUserlogin.php.

Referenced by SpecialChangePassword\execute(), and SpecialChangePassword\showForm().

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 1209 of file SpecialUserlogin.php.

Referenced by processLogin().

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|Integer The integer hit count or True if it is already at the limit

Definition at line 653 of file SpecialUserlogin.php.

Referenced by SpecialChangePassword\attemptReset().

LoginForm::initUser ( u,
autocreate 
) [private]

Actually add a user to the database.

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

Parameters:
$uUser object.
$autocreateboolean -- true if this is an autocreation via auth plugin
Returns:
Status object, with the User object in the value member on success

Definition at line 464 of file SpecialUserlogin.php.

Loader.

Definition at line 75 of file SpecialUserlogin.php.

Referenced by execute().

LoginForm::mailPasswordInternal ( u,
throttle = true,
emailTitle = 'passwordremindertitle',
emailText = 'passwordremindertext' 
)
Parameters:
$uUser object
$throttleBoolean
string$emailTitlemessage name of email title
string$emailTextmessage name of email text
Returns:
Status object

Definition at line 862 of file SpecialUserlogin.php.

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

Definition at line 1028 of file SpecialUserlogin.php.

Referenced by execute(), and processLogin().

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

Returns:
string

Definition at line 1328 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 1355 of file SpecialUserlogin.php.

Access:
private

Definition at line 1307 of file SpecialUserlogin.php.

Referenced by execute().

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

Definition at line 1269 of file SpecialUserlogin.php.

Referenced by processLogin().

Parameters:
$errorstring

Definition at line 848 of file SpecialUserlogin.php.

Referenced by processLogin().

static LoginForm::setCreateaccountToken ( ) [static]

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

Definition at line 1253 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 1226 of file SpecialUserlogin.php.

Referenced by SpecialChangePassword\execute().

Access:
private
Parameters:
$userUser
Returns:
Boolean

Definition at line 1189 of file SpecialUserlogin.php.

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

Definition at line 917 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 897 of file SpecialUserlogin.php.

Referenced by processLogin().

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:
$blockBlock the block causing this error
Exceptions:
ErrorPageError

Definition at line 963 of file SpecialUserlogin.php.

Referenced by processLogin().


Member Data Documentation

LoginForm::$mAbortLoginErrorMsg = 'login-abort-generic'

Definition at line 51 of file SpecialUserlogin.php.

LoginForm::$mAction

Definition at line 47 of file SpecialUserlogin.php.

LoginForm::$mCookieCheck

Definition at line 46 of file SpecialUserlogin.php.

LoginForm::$mCreateaccount

Definition at line 47 of file SpecialUserlogin.php.

LoginForm::$mCreateaccountMail

Definition at line 47 of file SpecialUserlogin.php.

LoginForm::$mDomain

Definition at line 48 of file SpecialUserlogin.php.

LoginForm::$mEmail

Definition at line 48 of file SpecialUserlogin.php.

ExternalUser LoginForm::$mExtUser = null [private]

Definition at line 56 of file SpecialUserlogin.php.

LoginForm::$mLanguage

Definition at line 48 of file SpecialUserlogin.php.

LoginForm::$mLoaded = false [private]

Definition at line 52 of file SpecialUserlogin.php.

LoginForm::$mLoginattempt

Definition at line 48 of file SpecialUserlogin.php.

LoginForm::$mOverrideRequest = null [private]

@ var WebRequest

Definition at line 61 of file SpecialUserlogin.php.

LoginForm::$mPassword

Definition at line 46 of file SpecialUserlogin.php.

LoginForm::$mPosted

Definition at line 46 of file SpecialUserlogin.php.

LoginForm::$mRealName

Definition at line 50 of file SpecialUserlogin.php.

LoginForm::$mReason

Definition at line 50 of file SpecialUserlogin.php.

LoginForm::$mRemember

Definition at line 48 of file SpecialUserlogin.php.

LoginForm::$mReturnTo

Definition at line 46 of file SpecialUserlogin.php.

LoginForm::$mReturnToQuery

Definition at line 49 of file SpecialUserlogin.php.

LoginForm::$mRetype

Definition at line 46 of file SpecialUserlogin.php.

LoginForm::$mSkipCookieCheck

Definition at line 49 of file SpecialUserlogin.php.

LoginForm::$mStickHTTPS

Definition at line 49 of file SpecialUserlogin.php.

LoginForm::$mToken

Definition at line 49 of file SpecialUserlogin.php.

LoginForm::$mType

Definition at line 50 of file SpecialUserlogin.php.

LoginForm::$mUsername

Definition at line 46 of file SpecialUserlogin.php.

const LoginForm::ABORTED = 8

Definition at line 39 of file SpecialUserlogin.php.

Referenced by ApiLogin\execute().

Definition at line 40 of file SpecialUserlogin.php.

Referenced by ApiLogin\execute().

Definition at line 37 of file SpecialUserlogin.php.

Referenced by ApiLogin\execute().

const LoginForm::ILLEGAL = 2

Definition at line 33 of file SpecialUserlogin.php.

Referenced by ApiLogin\execute().

Definition at line 43 of file SpecialUserlogin.php.

Referenced by ApiLogin\execute().

const LoginForm::NO_NAME = 1

Definition at line 32 of file SpecialUserlogin.php.

Referenced by ApiLogin\execute().

Definition at line 35 of file SpecialUserlogin.php.

Referenced by ApiLogin\execute().

Definition at line 38 of file SpecialUserlogin.php.

Referenced by ApiLogin\execute().

const LoginForm::SUCCESS = 0

Definition at line 31 of file SpecialUserlogin.php.

Referenced by ApiLogin\execute().

Definition at line 41 of file SpecialUserlogin.php.

Referenced by ApiLogin\execute().

Definition at line 42 of file SpecialUserlogin.php.

Referenced by ApiLogin\execute().

Definition at line 36 of file SpecialUserlogin.php.

Referenced by ApiLogin\execute().

Definition at line 34 of file SpecialUserlogin.php.

Referenced by ApiLogin\execute().

Definition at line 44 of file SpecialUserlogin.php.

Referenced by ApiLogin\execute().


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