/include/login.php

Description

Login related definitions and functions.

$Id$

Constants
LOGIN_CONFIG = 5 (line 75)

Login configuration error status code.

Used by the login code to indicate an error that requires reauthentication because of an error in the login configuration. Most of the time this will fail continually until the administrator intervenes, but at least with this status the theme can present a reason for failing logins.

LOGIN_EXPIRED = 4 (line 67)

Authentication expired status code.

Used by the login code to indicate an error that requires reauthentication because the authentication cookie has expired.

LOGIN_FAILED = 2 (line 54)

Failed login status code.

Used by the login code to indicate an error that requires reauthentication because the previous login attempt failed.

LOGIN_PRIVS = 3 (line 61)

Not enough privileges status code.

Used by the login code to indicate an error that requires reauthentication because the previous login attempt succeeded but the autenticated user does not have enough privileges.

LOGIN_REQUIRED = 1 (line 44)

Login required status code.

Used by the login code to indicate that authentication is required.

PASSWORD_CHANGE = 1 (line 84)

Change password status code.

Used by the password change code to indicate the initiation of a password change.

PASSWORD_MISMATCH = 3 (line 100)

Password mismatch status code.

Used by the password change code to indicate an error that requires re-entering of the password information because the newly chosen password fields did not match.

PASSWORD_WRONG = 2 (line 94)

Wrong password status code.

Used by the password change code to indicate an error that requires re-entering of the password information because the password entered was not correct for the user changing the password.

TKT_ERROR = 1 (line 18)

Ticket signature verification error code.

Value returned by the verifyTicket function when there was an error verifying the ticket signature.

TKT_EXPIRED = 3 (line 30)

Expired ticket error code.

Value returned by the verifyTicket function when the ticket signature is valid but it has expired.

TKT_FALSE = 2 (line 24)

Invalid ticket signature error code.

Value returned by the verifyTicket function when the ticket signature is invalid.

TKT_NOTFOUND = 4 (line 36)

No ticket status code

Value returned by the verifyTicket function when the user did not present a ticket with this request.

Functions
changePassword (line 322)

Allows users to change their password before continuing the page.

This function will not return unless the change password process has been completed (and will in fact redirect the user to the change password page in the meantime).

void changePassword ()
defaultBackURL (line 494)

Default redirect url for login procedures, for when a user explicitly requests a login or logout page and so we don't know where to go at the end of the request.

  • return: the url to redirect to
string defaultBackURL ()
hasPriv (line 234)

Determine whether the current user has a certain privilege (out of a set).

This returns true if the current user was granted the specified privilege, or one out of the set of specified privileges.

  • return: true if the current user has been granted (one of) the privilege(s)
bool hasPriv ([mixed $priv = ""])
  • mixed $priv: the privilege or set of privileges to check for
listPrivs (line 202)

List privileges for a user.

Returns an array of privilege names that the requested user has. If no user was specified, it returns the privileges for the current user. If the specified user id was not found, it returns -1.

  • return: array of privilege names assigned to the user or -1 if user not found
mixed listPrivs ([int $userid = -1])
  • int $userid: the ID of the user to list privileges for (default: current user)
loggedIn (line 165)

Returns true if a user is succesfully authenticated.

  • return: true if user is logged in, false if not
bool loggedIn ()
logout (line 344)

Logs out the current user before continuing the page.

This function will not return unless the logout process has been completed.

void logout ()
makeLoginURL (line 380)

Construct the sws login related URL.

  • access: public
void makeLoginURL ([string $url = ""])
  • string $url: the url to append (without $swsurl/login)
onLoginHost (line 363)

Return true if the current request was for the login host.

void onLoginHost ()
privInSet (line 176)

Determine whether privilege $priv is in the set $set.

  • return: true if the privilege is in the set, false otherwise
bool privInSet (string $priv, array $set)
  • string $priv: privilege to check for
  • array $set: array of privileges to search in
requireLogin (line 286)

Requires an authenticated user before continuing with the page.

This function must be called before anything is output to the browser. It requires that a valid user has authenticated, and optionally requires specific privilege(s). This function does not return unless these requirements are met (and will in fact redirect the user to another page to present his credentials if those requirements are not met).

void requireLogin ([mixed $privs = ""])
  • mixed $privs: a string or an array of strings of privileges to check against
verifyTicket (line 116)

Verifies and returns the user's decrypted ticket cookie.

This function is the heart of the user authentication system. It tries to verify the user's ticket cookie by decoding it, verifying it cryptographically, and then testing whether it has expired.

mixed verifyTicket ()

Documentation generated on Fri, 30 Jun 2006 10:31:37 +0200 by phpDocumentor 1.3.0RC3