The module triggers a few Yii Events that allow advanced programming and custom code to be injected. The following events are available via the comyii\user\Module
class:
Module::EVENT_BEFORE_ACTION
orbeforeAction
Module::EVENT_REGISTER_BEGIN
orbeforeRegister
Module::EVENT_REGISTER_COMPLETE
orregisterComplete
Module::EVENT_LOGIN_BEGIN
orloginBegin
Module::EVENT_LOGIN_COMPLETE
orloginComplete
Module::EVENT_LOGOUT
orlogout
Module::EVENT_PASSWORD_BEGIN
orpasswordBegin
Module::EVENT_PASSWORD_COMPLETE
orpasswordComplete
Module::EVENT_RECOVERY_BEGIN
orrecoveryBegin
Module::EVENT_RECOVERY_COMPLETE
orrecoveryComplete
Module::EVENT_RESET_BEGIN
orresetBegin
Module::EVENT_RESET_COMPLETE
orresetComplete
Module::EVENT_ACTIVATE_BEGIN
oractivateBegin
Module::EVENT_ACTIVATE_COMPLETE
oractivateComplete
Module::EVENT_AUTH_BEGIN
orauthBegin
Module::EVENT_AUTH_COMPLETE
orauthComplete
Module::EVENT_NEWEMAIL_BEGIN
ornewemailBegin
Module::EVENT_NEWEMAIL_COMPLETE
ornewemailComplete
Module::EVENT_EXCEPTION
orexception
Namespace: comyii\user\events\RegistrationEvent
The RegistrationEvent
allows you to programmatically control your application workflow before and after an user account registration.
Module::EVENT_REGISTER_BEGIN
Module::EVENT_REGISTER_COMPLETE
- Data Type: yii\db\ActiveRecord
- Default Value:
NULL
The current user active record.
- Data Type:
string|array
- Default Value:
Yii::$app->user->returnUrl
The URL to be redirected to - will default automatically to the returnUrl
. See comyii\controllers\BaseController::safeRedirect
method.
- Data Type: string
- Default Value:
Module::viewSettings[Module::VIEW_REGISTER]
The main view file to be displayed. If this is NULL
or not set the default view file (views/account/register
) will be used for display as set in Module::viewSettings[Module::VIEW_REGISTER]
.
- Data Type: boolean
- Default Value:
false
The current status for the controller. This is necessary for event handlers to communicate to the controller whether to not abort the registration process. If set to true
, the registration will fail.
- Data Type: string
- Default Value:
NULL
The session flash message type as used by Yii::$app->session->setFlash
.
- Data Type: string
- Default Value:
NULL
The session flash message for the controller passed via Yii::$app->session->setFlash
. This is used so that event handlers can update the success messages for scenarios like user registration.
- Data Type: string
- Default Value:
NULL
The user type for registration. This is used if there are multiple registration types (i.e. different user types).
- Data Type: boolean
- Default Value:
false
Whether or not to activate the user account.
- Data Type: boolean
- Default Value:
false
The current user activation status.
Namespace: comyii\user\events\LoginEvent
The LoginEvent
allows you to programmatically control your application workflow before and after an user account login.
Module::EVENT_LOGIN_BEGIN
Module::EVENT_LOGIN_COMPLETE
- Data Type: yii\db\ActiveRecord
- Default Value:
NULL
The current user active record (if logged in) or the login model (before login).
- Data Type:
string|array
- Default Value:
Yii::$app->user->returnUrl
The URL to be redirected to - will default automatically to the returnUrl
. See comyii\controllers\BaseController::safeRedirect
method.
- Data Type: string
- Default Value:
Module::viewSettings[Module::VIEW_LOGIN]
The main view file to be displayed. If this is NULL
or not set the default view file (views/account/login
) will be used for display as set in Module::viewSettings[Module::VIEW_LOGIN]
.
- Data Type: boolean
- Default Value:
false
The current status for the controller. This is necessary for event handlers to communicate to the controller whether to not abort the login process.
- Data Type: string
- Default Value:
NULL
The session flash message type as used by Yii::$app->session->setFlash
.
- Data Type: string
- Default Value:
NULL
The session flash message for the controller passed via Yii::$app->session->setFlash
. This is used so that event handlers can update the success messages for scenarios like user registration.
- Data Type: boolean
- Default Value:
Module::socialSettings['enabled']
Whether social authentication is enabled. If not set, this defaults to the Module::socialSettings
setting.
- Data Type: string|array
- Default Value:
false
The social authentication action. If not set, defaults to Module::ACTION_SOCIAL_AUTH
set within Module::actionSettings
.
- Data Type: boolean
- Default Value:
false
Whether an account unlock attempt after expiry. Defaults to false
.
- Data Type: boolean
- Default Value:
false
Whether a new password has been set after expiry. Defaults to false
.
- Data Type: integer
- Default Value:
NULL
The account status at login. Should be one of the Module::STATUS
constants.
- Data Type: string
- Default Value:
NULL
The login section title.
- Data Type: string
- Default Value:
NULL
The social auth login section title.
- Data Type: integer
- Default Value:
NULL
The result of the login attempt. Should be one of the values below:
LoginEvent::RESULT_SUCCESS
or1
LoginEvent::RESULT_FAIL
or2
LoginEvent::RESULT_LOCKED
or3
LoginEvent::RESULT_ALREADY_AUTH
or4
LoginEvent::RESULT_EXPIRED
or5