AuthService
class AuthService
Supports authentication operations.
Methods
Checks if a user is logged in.
Hashes password.
Tests for login attempts and sets session messages when there is a failed attempt or when account is locked.
Creates a session when the user logs in. A new record is added to the user_sessions table and a cookie is created if remember me is selected.
Logs in user from cookie.
Logs user out.
Perform logout operation on current logged in user. The record for the current logged in user is removed from the user_session table and the corresponding cookie is deleted.
Handles upload for profile image.
Details
at line 28
static string
confirm(Input $request)
Gets value of password confirm field. Assumes field value is "confirm".
at line 38
static Users|null
currentUser()
Checks if a user is logged in.
at line 52
static string
hashPassword(string $password)
Hashes password.
at line 66
static Login
login(Input $request, Login $loginModel, string $username, bool $mailer = false)
Processes login attempts
at line 106
static Login
loginAttempts(Users $user, Login $loginModel, bool $mailer = false)
Tests for login attempts and sets session messages when there is a failed attempt or when account is locked.
at line 135
static void
loginUser(Users $loginUser, bool $rememberMe = false)
Creates a session when the user logs in. A new record is added to the user_sessions table and a cookie is created if remember me is selected.
at line 170
static Users|null
loginUserFromCookie()
Logs in user from cookie.
at line 187
static void
logout()
Logs user out.
at line 202
static bool
logoutUser(Users $user)
Perform logout operation on current logged in user. The record for the current logged in user is removed from the user_session table and the corresponding cookie is deleted.
at line 223
static void
passwordReset(Input $request, Users $user)
Resets password.
at line 246
static Uploads|null
profileImageUpload(Users $user)
Handles upload for profile image.