OnManagerLogin
Last updated Sep 17th, 2020 | Page history | Improve this page | Report an issue
Support the team building MODX with a monthly donation.
The budget raised through OpenCollective is transparent, including payouts, and any contributor can apply to be paid for their work on MODX.
Backers
Budget
$311 per month—let's make that $500!
Learn moreEvent: OnManagerLogin¶
Fires anytime a user successfully logs into the manager after performing any autentification checks successfully. Doesn't affect the autentification process.
- Service: 2 - Manager Access Events
- Group: None
Event Parameters¶
Name | Description |
---|---|
user | A reference to the modUser object. |
attributes | An array of: - rememberme - Boolean set if user wants password to be remembered. |
- lifetime - The session cookie lifetime for this login. | |
- loginContext - The context key this login is occurring in. | |
- addContexts - Additional contexts in which the login is also occuring in. |
Event Login Workflow¶
- OnBeforeWebLogin || OnBeforeManagerLogin - Inside this event the developer can check for erroneous parameters which will disallow further logging in process. If plugins executed by this event return something except true, the logging in will be aborted with the specified error.
- OnUserNotFound - This event is executed only if the provided username is not found inside MODX database. The developer can provide it's own modUser object in the event output to continue the login process.
- OnWebAuthentication || OnManagerAuthentication - Inside this event the developer can check for parameters which will override the default checking by password and allow further logging in process. If one of the plugins executed from this event return true, the user is considered verified and logged in.
- OnWebLogin || OnManagerLogin - This event is fired after the logging in process has finished and the user is considered logged in. It doesn't change the logging in process behaviour.
Example¶
Such a plugin will write to the "Error log" who logged in and where:
<?php
$eventName = $modx->event->name;
switch($eventName) {
case 'OnManagerLogin':
$id = $user->get('id');
$modx->log(modX::LOG_LEVEL_ERROR, 'User logged in with id '.$id.print_r($attributes));
break;
}
See Also¶
Support the team building MODX with a monthly donation.
The budget raised through OpenCollective is transparent, including payouts, and any contributor can apply to be paid for their work on MODX.
Backers
Budget
$311 per month—let's make that $500!
Learn more