/user/login

Exports the login method for the /api/user/login route.

Requires

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.

Parameters:
NameTypeDescription
reqreq

HTTP request.

resres

HTTP response.

Properties
NameTypeDescription
req.paramsObject

HTTP request parameter.

Properties
NameTypeAttributesDescription
userObject<optional>

Mapp User object.

req.bodyObject

HTTP POST request body.

(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.

Parameters:
NameTypeDescription
reqreq

HTTP request.

resres

HTTP response.

Properties
NameTypeDescription
req.paramsObject

HTTP request parameter.