Documentation

UserAuth
in package
implements UserAuthInterface

A default implementation of user auth when the users module is not installed.

Methods here will however use the installed service, if available.

Table of Contents

Interfaces

UserAuthInterface
Provides user authentication functions for the front-end

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([mixed $msg = null ]) : void
Parameters
$msg : mixed = null

Optional message to display on the login page

Tags
inheritdoc

configure()

Configure the service.

public static configure(array<string|int, mixed> $config) : void
Parameters
$config : array<string|int, mixed>
Tags
inheritdoc

getId()

Gets id of logged-in user

public static getId() : int
Tags
inheritdoc
Return values
int —

0 if user isn't logged in

isLoggedIn()

Check if the user is logged in or not

public static isLoggedIn() : bool
Tags
inheritdoc
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 = ''
Tags
inheritdoc
On this page

Search results