/user/login

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

Requires

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.

Parameters:
NameTypeDescription
reqreq

HTTP request.

resres

HTTP response.

Properties
NameTypeAttributesDescription
req.paramsObject

HTTP request parameter.

Properties
NameTypeAttributesDescription
msgstring<optional>

A message string in regards to a failed loging.

userObject<optional>

Mapp User object.

req.bodyObject<optional>

HTTP POST request body.

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

Parameters:
NameTypeDescription
reqreq

HTTP request.

resres

HTTP response.

Properties
NameTypeDescription
req.paramsObject

HTTP request parameter.

req.bodyObject

HTTP POST request body.