Constructor
new AuthenticationController()
Members
loginValidation :Array.<express.RequestHandler>
Validation for the login form. Only the email is refilled after an error.
Type:
- Array.<express.RequestHandler>
middleware :express.Router
Session and authenticated-user middleware.
Type:
- express.Router
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>
routes :express.Router
Login, registration and logout routes.
Type:
- express.Router
Methods
(async, static) handleLogin()
(static) handleLogout()
(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. |
Returns:
- Type
- express.RequestHandler