Class: AuthenticationController

AuthenticationController()

AuthenticationController handles user authentication, registration, and session management.

Constructor

new AuthenticationController()

Source:

Members

loginValidation :Array.<express.RequestHandler>

Validation for the login form. Only the email is refilled after an error.

Type:
  • Array.<express.RequestHandler>
Source:

middleware :express.Router

Session and authenticated-user middleware.

Type:
  • express.Router
Source:

registerValidation :Array.<express.RequestHandler>

Validation for the registration form. Limits match the users table columns; the password is limited to 72 UTF-8 bytes because bcrypt ignores the rest.

Type:
  • Array.<express.RequestHandler>
Source:

routes :express.Router

Login, registration and logout routes.

Type:
  • express.Router
Source:

Methods

(async, static) handleLogin()

Source:

(static) handleLogout()

Source:

(static) restrict(allowedRoles) → {express.RequestHandler}

Restrict access to users with one of the specified roles.

Parameters:
Name Type Description
allowedRoles Array.<("admin"|"trainer"|"member")>

Roles allowed to access the resource.

Source:
Returns:
Type
express.RequestHandler

(static) viewLogin()

Source: