/user/login
Exports the login method for the /api/user/login route.
- Source
Requires
- module:/user/fromACL
- module:/view
- module:jsonwebtoken
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 loginView method will be returned with a message from a failed user validation or if no login post request body is provided.
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.
A user cookie will signed and set as response header.
The response will be redirected to the location from the redirect cookie. The redirect cookie will be removed.
Name | Type | Description |
---|---|---|
req.params | Object | HTTP request parameter. |
req.body | Object | HTTP POST request body. |
- Source
(inner) loginView(req, res)
Any existing user cookie for the XYZ instance will be removed [set to null].
A redirect cookie will be set to the response header for a redirect to the location after sucessful login.
The default login_view
will be set as template request parameter before the XYZ View API method will be returned.
Name | Type | Description |
---|---|---|
req.params | Object | HTTP request parameter. |
- Source