Skip to content

Commit 63f5619

Browse files
committed
docs(plugin-auth): the lockout belongs to the account the credential check resolves
The authentication guide states which account the password-stage counter and lock are held on, and the changeset records the fix for plugin-auth. Claude-Session: https://claude.ai/code/session_01KqkTQNLcxVc588eZpJmp1r Co-authored-by: Claude <noreply@anthropic.com>
1 parent 9bcb6e9 commit 63f5619

2 files changed

Lines changed: 18 additions & 0 deletions

File tree

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
---
2+
'@objectstack/plugin-auth': patch
3+
---
4+
5+
fix(plugin-auth): the account lockout resolves the account the sign-in credential check resolves
6+
7+
Clause-②: no
8+
9+
- **One account per sign-in.** The ADR-0069 D2 lock gate, its failed sign-in counter and the `login_failed` / `account_locked` account events now share one resolver. It looks the account up exactly as better-auth's `/sign-in/email` credential check does, so all four name the same account for every identifier the credential check resolves to it.
10+
- **What that guarantees.** Every refused sign-in that resolves to an account counts toward that account's one lock. An existing lock refuses every sign-in that resolves to the account, including one with the correct password. A successful sign-in clears the counter, as before. An identifier that resolves to no account changes no account and writes no account event.
11+
- **Nothing to migrate.** The lockout state stays on the account's own `sys_user` row (`failed_login_count`, `locked_until`), written by its id, and `lockoutThreshold` / `lockoutDurationMinutes` keep their meaning.

‎content/docs/permissions/authentication.mdx‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -564,6 +564,13 @@ so a locked password stage and a locked second factor are independent states. Ea
564564
counter resets on a success at its own stage, and the admin **Unlock Account**
565565
action clears both at once.
566566

567+
The password-stage counter and lock belong to the **account**, not to the text
568+
typed into the sign-in form. Both live on the `sys_user` row that the sign-in's own
569+
credential check resolves the address to. So every refused sign-in on that account
570+
counts toward its one lock, whichever spelling of the address it used. A lock refuses
571+
every sign-in that resolves to the account, the correct password included, and a
572+
successful sign-in under any spelling clears the counter.
573+
567574
Setting `lockout_threshold` to `0` disables the **password-stage** lockout only.
568575
Two-factor verification keeps a built-in limit of 10 attempts per 15 minutes,
569576
because it is the last check before a session is issued. Two-factor verification

0 commit comments

Comments
 (0)