fromACL

This module exports a function to authenticate a user based on a provided email and password.

Methods

(async, inner) failedLogin(request) → {Promise.<Error>}

Handles a failed login attempt and increases the failed attempts on the ACL.

Parameters:
NameTypeDescription
requestObject

The request object.

Properties
NameTypeDescription
emailstring

The email address of the user.

languagestring

The language for the user.

hoststring

The host for the account verification email.

remote_addressstring

The IP address of the client.

Returns:

A Promise that resolves with an Error indicating that authentication failed.

Type: 
Promise.<Error>

(async, inner) fromACL(req) → {Promise.<(Object|Error)>}

Authenticates a user based on the provided email and password.

Parameters:
NameTypeDescription
reqObject

The request object.

Properties
NameTypeAttributesDescription
body.emailstring<optional>

The email address of the user.

body.passwordstring<optional>

The password of the user.

params.languagestring<optional>

The language for the user.

headersObject

The request headers.

Properties
NameTypeAttributesDescription
authorizationstring<optional>

The authorization header containing the email and password.

headers['x-forwarded-for']string<optional>

The IP address of the client.

Returns:

A Promise that resolves with the user object or an Error if authentication fails.

Type: 
Promise.<(Object|Error)>

(async, inner) getUser(request) → {Promise.<(Object|Error)>}

Retrieves the user from the ACL and updates the access_log property.

Parameters:
NameTypeDescription
requestObject

The request object.

Properties
NameTypeDescription
emailstring

The email address of the user.

dateDate

The current date and time.

remote_addressstring

The IP address of the client.

languagestring

The language for the user.

hoststring

The host for the account verification email.

Returns:

A Promise that resolves with the user object or an Error if the user is not found or authentication fails.

Type: 
Promise.<(Object|Error)>

(async, inner) userExpiry(user, request) → {Promise.<boolean>}

Checks if the user account has expired.

Parameters:
NameTypeDescription
userObject

The user object.

requestObject

The request object.

Properties
NameTypeDescription
emailstring

The email address of the user.

languagestring

The language for the user.

Returns:

A Promise that resolves with a boolean indicating if the user account has expired.

Type: 
Promise.<boolean>