Jump to main content Jump to doc navigation

OnWebAuthentication

Other versions: 3.x — Other languages: EN RU — Found a problem? Please edit this page or report an issue.

Event: OnWebAuthentication

Fires right before the user is authenticated or its session is added for any non-manager context. This event can be used to provide external authentication support. This event is used to ALLOW login.

If its output is true, or an array where at least one index is set to true, then MODX will assume that the user has successfully logged in and bypass the default authentication via password.

Service: 3 - Web Access Events Group: None

Event Parameters

Name Description
& user A reference to the modUser object. Passed by reference
password The provided password.
rememberme Whether or not to remember the user via cookie.
lifetime The lifetime of the session cookie.
& loginContext The context key this login is occurring in. Passed by reference
& addContexts Additional contexts in which the login is also occuring in. Passed by reference

Event Login Workflow

  1. 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.
  2. 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.
  3. 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.
  4. 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.

See Also