/user/login
Exports the login method for the /api/user/login route.
- Source
Requires
- module:/user/fromACL
- module:/view
- module:jsonwebtoken
Methods
(async, inner) login(req, res)
Requests which require authentication will return the login method if the authentication fails.
The login method will request a user from the fromACL() method.
A user cookie will be assigned for the user returned from the fromACL() method and the response will be redirected to the intended target location.
The loginView method will be returned with a message from a failed user validation or if no login post request body is provided.
The _redirect cookie set by the loginView method will be removed on redirect.
Name | Type | Description | ||||||||
---|---|---|---|---|---|---|---|---|---|---|
req.params | Object | HTTP request parameter. Properties
| ||||||||
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