feat: lock check and login history on admin sign-in and sign-out

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01EFUzfj5akPxyikzGc2iAHM
This commit is contained in:
ngqileandClaude Opus 5.5 committed 2026-11-30 13:43:42 +08:00
1 parent f6fe246ad0
commit 39708224ad
7 files changed
+349 -3

No files matched your search

@@ -2,7 +2,7 @@
### Requirement: Login history
The system SHALL record every admin sign-in attempt, sign-out, unlock and own password change, with the time, username as typed, event, client IP, user agent and, for a known username, the user's company. Events: `LOGIN_SUCCESS`, `LOGIN_FAIL`, `LOGIN_LOCKED`, `LOGOUT`, `UNLOCK_RESET`, `PASSWORD_CHANGED`. Recording SHALL be best-effort and MUST NOT change the sign-in answer. A blank username or password SHALL NOT be recorded.
The system SHALL record every admin sign-in attempt, sign-out, unlock and own password change, with the time, trimmed username, event, client IP, user agent and, for a known username, the user's company. Events: `LOGIN_SUCCESS`, `LOGIN_FAIL`, `LOGIN_LOCKED`, `LOGOUT`, `UNLOCK_RESET`, `PASSWORD_CHANGED`. Recording SHALL be best-effort and MUST NOT change the sign-in answer. A blank username or password SHALL NOT be recorded.
#### Scenario: Successful sign-in is recorded
@@ -47,7 +47,7 @@ Design: `design.md`. All tasks run serially: each builds on the one before.
## 3. mobile-api
- [ ] 3.1 Sign-in and sign-out enforcement and recording (design decisions 5 and 6).
- [x] 3.1 Sign-in and sign-out enforcement and recording (design decisions 5 and 6).
- **Tests first:**
- blank fields record nothing;
- locked returns 401 `ACCOUNT_LOCKED`, records `LOGIN_LOCKED`, and never calls services-auth;