-
Notifications
You must be signed in to change notification settings - Fork 52
Authentication library
We recommend to autoload the Authentication library so its functionality is available on all pages. This is especially important if you require user information on all pages (eg. to check if user is logged in).
This checks if a user is signed in.
Returns boolean value.
Providing username and entered password it will check if the entered data matches with database and sign in user with redirect to homepage or to another page that is defined via session or GET. This will allow you redirect the user after sign in to the page they tried to access earlier. This is useful if session expires and is recommended that all user pages have the following code on them to allow for this functionality:
// Redirect unauthenticated users to signin page
if ( ! $this->authentication->is_signed_in())
{
redirect('account/sign_in/?continue='.urlencode(base_url('account/TARGET_USER_PAGE')));
}
Calling this function will sign out user and redirect him to homepage.
Checks if the password is correct. This is mainly used by sign_in()
, but it is also useful for functionality where you need to reconfirm user's identity. You need to enter the hashed password that is stored in the DB and then the password entered.
Will return boolean.
-
sign_in_by_id($account_id, $remember = FALSE)
the act of sign in itself was moved to this function. This function is utilized when using other authentication sources to sign in. After successful login, user is redirected to the homepage. -
check_password()
has become a private function.