Property | Type | Description | |
---|---|---|---|
$_config | |||
$_name | |||
$_sess | |||
$_user |
Method | Description | |
---|---|---|
check ( $password, $hash ) : boolean | Checks if password matches hash | |
check_password ( $user, $password ) : boolean | Validates a password against a user. This can be used to confirm user in actions where you ask for password while user is logged in to be extra safe (eg when deleting account) | |
complete_login ( $user, $remember = FALSE ) : TRUE | Updates session, set remember cookie (if required) | |
failed_login ( $user ) : FALSE | Registers a failed login attempt | |
get_user ( ) : object | Returns the user - if any | |
hash ( $input, $salt = NULL, $cost = NULL ) : string | Generates bcrypt hash for input | |
instance ( $_name = 'a1' ) : object | Return a static instance of A1. | |
logged_in ( ) : boolean | Returns TRUE is a user is currently logged in | |
login ( $username, $password, $remember = FALSE ) : mixed | Attempt to log in a user. | |
logout ( $destroy = FALSE ) : boolean | Log out a user by removing the related session variables. | |
session ( $id = NULL ) : Session | (Initializes &) Returns the session we're working with | |
set_user ( $user ) : object | Sets the user that is logged in | |
store_user_in_session ( $user ) : void | Stores user model in session |
Method | Description | |
---|---|---|
__construct ( $_name = 'a1', $_config ) : void | Loads Session and configuration options. | |
_get_failed_attempts ( $user ) : void | Returns the number of failed login attempts | |
_increment_failed_attempts ( $user ) : void | Increment the number of failed login attempts since last successfull login | |
_increment_logins ( $user ) : void | Increment the number of logins of the user by 1 | |
_load_user ( $username ) : object | Loads the user object from database using username | |
_reset_failed_attempts ( $user ) : void | Reset the number of failed login attempts | |
_save_user ( $user ) : void | Saves the user object | |
_set_last_attempt ( $user ) : void | Sets the last attempt field of the user object to current time | |
_set_last_login ( $user ) : void | Sets the last login field of the user object to current time | |
find_user ( ) : object | Finds the user in the session (if any) |
protected __construct ( $_name = 'a1', $_config ) : void | ||
return | void |
protected _get_failed_attempts ( $user ) : void | ||
return | void |
protected _increment_failed_attempts ( $user ) : void | ||
return | void |
protected _increment_logins ( $user ) : void | ||
return | void |
abstract protected _load_user ( $username ) : object | ||
return | object | User Object |
protected _reset_failed_attempts ( $user ) : void | ||
return | void |
protected _save_user ( $user ) : void | ||
return | void |
protected _set_last_attempt ( $user ) : void | ||
return | void |
protected _set_last_login ( $user ) : void | ||
return | void |
public check_password ( $user, $password ) : boolean | ||
return | boolean | Success |
public complete_login ( $user, $remember = FALSE ) : TRUE | ||
return | TRUE |
public failed_login ( $user ) : FALSE | ||
return | FALSE |
public session ( $id = NULL ) : Session | ||
return | Session |
public store_user_in_session ( $user ) : void | ||
return | void |