BeforeLoginAttemptFunction
BeforeLoginAttemptFunction = (
params) =>Promise<{error?:string;ok:boolean; }>
Allows to reject login attempt before AdminForth checks credentials in the database. Called on every call of login endpoint, even if username does not exist or password is wrong, so it is a right place for captcha and other anti-bruteforce checks: user gets the same response regardless of whether credentials were correct.
Parameters
| Parameter | Type | Description |
|---|---|---|
params | { adminforth: IAdminForth; extra: HttpExtra; username: string; } | - |
params.adminforth | IAdminForth | Adminforth instance. |
params.extra | HttpExtra | Extra HTTP information of login request. Use extra.response to set custom status or headers. |
params.username | string | Username which user tries to login with, normalized in same way as it is stored in database. |
Returns
Promise<{ error?: string; ok: boolean; }>