LoginEvent
extends GenericHookEvent
in package
Class LoginEvent
This event (civi.standalone.login) is fired various times during the standalone login process.
Generally, listeners may set stopReason to a valid string (see below) to prevent login continuing.
Table of Contents
Properties
- $stage : string
- What stage are we at?
- $stopReason : null|string
- If set, authentication will not proceed.
- $userID : int
- The user ID of the user attempting to login.
- $hookFields : array<string|int, mixed>
- $hookFieldsFlip : array<string|int, mixed>
- $hookValues : array<string|int, mixed>
Methods
- __construct() : mixed
- Class constructor.
- __get() : mixed
- __isset() : mixed
- __set() : mixed
- __unset() : mixed
- addReturnValues() : GenericHookEvent
- create() : GenericHookEvent
- Create a GenericHookEvent using key-value pairs.
- createOrdered() : GenericHookEvent
- Create a GenericHookEvent using ordered parameters.
- getHookValues() : array<string|int, mixed>
- getReturnValues() : mixed
- hasField() : bool
- Determine whether the hook supports the given field.
Properties
$stage
What stage are we at?
public
string
$stage
Valid values:
-
'pre_credentials_check'
userID should be set if the user exists but the password has not been checked yet. Example use: per IP/per user flood checks.
-
'post_credentials_check'
userID must be set; password has been checked and stopReason should be 'wrongUserPassword' or NULL. Example use: limit incorrect password attempts per user.
-
'post_mfa'
userID must be set; password was OK. stopReason should be 'wrongMFA' (about to reject login)' or NULL (login about to happen). Example use: identify suspicious activity?
-
'login_success'
userID is set; password was correct. MFA was correct if used. User is successfully logged in. Setting stopReason would have no effect. Example use: monitor logins.
-
'pre_send_password_reset'
userID is set if the entered username/email matched, otherwise NULL. Throwing an exception will (silently) prevent the email being sent.
$stopReason
If set, authentication will not proceed.
public
null|string
$stopReason
= NULL
It may be set when the event is created or altered by listeners, e.g. loginPrevented
Valid values:
- 'wrongUserPassword'
- 'wrongMFA'
- 'loginPrevented'
$userID
The user ID of the user attempting to login.
public
int
$userID
NULL if the username provided was invalid.
$hookFields
protected
array<string|int, mixed>
$hookFields
Ex: array(0 => 'contactID', 1 => 'contentPlacement').
$hookFieldsFlip
protected
array<string|int, mixed>
$hookFieldsFlip
Ex: array('contactID' => 0, 'contentPlacement' => 1).
$hookValues
protected
array<string|int, mixed>
$hookValues
Ex: array(0 => &$contactID, 1 => &$contentPlacement).
Methods
__construct()
Class constructor.
public
__construct(string $stage, int|null $userID[, string|null $stopReason = null ]) : mixed
Parameters
- $stage : string
- $userID : int|null
- $stopReason : string|null = null
__get()
public
& __get(mixed $name) : mixed
Parameters
- $name : mixed
Tags
__isset()
public
__isset(mixed $name) : mixed
Parameters
- $name : mixed
Tags
__set()
public
__set(mixed $name, mixed $value) : mixed
Parameters
- $name : mixed
- $value : mixed
Tags
__unset()
public
__unset(mixed $name) : mixed
Parameters
- $name : mixed
Tags
addReturnValues()
public
addReturnValues(mixed $fResult) : GenericHookEvent
Parameters
- $fResult : mixed
Return values
GenericHookEventcreate()
Create a GenericHookEvent using key-value pairs.
public
static create(array<string|int, mixed> $params) : GenericHookEvent
Parameters
- $params : array<string|int, mixed>
-
Ex: array('contactID' => &$contactID, 'contentPlacement' => &$contentPlacement).
Return values
GenericHookEventcreateOrdered()
Create a GenericHookEvent using ordered parameters.
public
static createOrdered(array<string|int, mixed> $hookFields, array<string|int, mixed> $hookValues) : GenericHookEvent
Parameters
- $hookFields : array<string|int, mixed>
-
Ex: array(0 => 'contactID', 1 => 'contentPlacement').
- $hookValues : array<string|int, mixed>
-
Ex: array(0 => &$contactID, 1 => &$contentPlacement).
Return values
GenericHookEventgetHookValues()
public
getHookValues() : array<string|int, mixed>
Tags
Return values
array<string|int, mixed> —Ex: array(0 => &$contactID, 1 => &$contentPlacement).
getReturnValues()
public
getReturnValues() : mixed
hasField()
Determine whether the hook supports the given field.
public
hasField(string $name) : bool
The field may or may not be empty. Use isset() or empty() to check that.
Parameters
- $name : string