UserAuthInterface
extends
ServiceInterface
in
Provides user authentication functions for the front-end
Table of Contents
Methods
- checkLogin() : void
- If the user is not logged in, redirect them to a login page.
- configure() : void
- Configure the service.
- getId() : int
- Gets id of logged-in user
- isLoggedIn() : bool
- Check if the user is logged in or not
- logout() : mixed
- Logs a user out, optional redirect
Methods
checkLogin()
If the user is not logged in, redirect them to a login page.
public
static checkLogin([string $msg = null ]) : void
Parameters
- $msg : string = null
-
Optional message to display on the login page
configure()
Configure the service.
public
static configure(array<string|int, mixed> $config) : void
Parameters
- $config : array<string|int, mixed>
getId()
Gets id of logged-in user
public
static getId() : int
Return values
int —0 if user isn't logged in
isLoggedIn()
Check if the user is logged in or not
public
static isLoggedIn() : bool
Return values
bool —True if the user is logged in, false otherwise
logout()
Logs a user out, optional redirect
public
static logout([mixed $redirect = '' ]) : mixed
Parameters
- $redirect : mixed = ''