Skip to main content

Module lockable

Module lockable 

Source
Expand description

lockable module โ€” locks an account after repeated failed sign-ins and auto-unlocks after auth.unlock_in seconds. Operates on the conventional users columns (failed_attempts, locked_at) via backend-agnostic SQL, gated at runtime by auth.modules. Email-based unlock is a follow-up; the time-based unlock strategy needs no mailer.

Functionsยง

ensure_not_locked
Reject a sign-in attempt for a locked account. Auto-unlocks (and allows the attempt) once unlock_in seconds have elapsed since locked_at. No-op when the module is disabled.
record_failure
Record a failed sign-in: increment failed_attempts and lock the account (stamp locked_at) once it reaches maximum_attempts. No-op when disabled.
reset_attempts
Clear the failed-attempt counter and lock on a successful sign-in. No-op when the module is disabled.