/user/login
Exports the login method for the /api/user/login route.
- Source
Requires
- module:/user/fromACL
- module:/view
- module:jsonwebtoken
- module:/utils/processEnv
Methods
(inner) login(req, res)
The method will shortcircuit if the fromACL module exports null with a missing ACL configuration.
Requests which require authentication will return the login method if the authentication fails.
The loginBody method will be called if the request has a POST body.
The view method will be called with login_view template with a message from a failed user validation or if no login post request body is provided.
| Name | Type | Description |
|---|---|---|
req | req | HTTP request. |
res | res | HTTP response. |
| Name | Type | Attributes | Description | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
req.params | Object | HTTP request parameter. Properties
| |||||||||||||
req.body | Object | <optional> | HTTP POST request body. |
- Source
(async, inner) loginBody(req, res)
A user object will be requested from the ACL.
The method checks for a redirect location on a _redirect cookie.
The login view will be returned if the fromACL() errs.
The user will be passed with the request and response object to the user/direct module.
| Name | Type | Description |
|---|---|---|
req | req | HTTP request. |
res | res | HTTP response. |
| Name | Type | Description |
|---|---|---|
req.params | Object | HTTP request parameter. |
req.body | Object | HTTP POST request body. |
- Source