Add admin login activity logging
- Add AdminLoginLog model to track all login attempts - Record successful and failed login attempts - Capture IP address and user agent for each login - Create /admin/login-logs page to view activity history - Show login stats (successes, failures, last 30 days) - Display browser/device and IP for each login - Add "Login activity" link to admin menu - Useful for security auditing and monitoring access Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Haiku 4.5
parent
53dd963090
commit
ea6f9d2e25
@@ -383,3 +383,13 @@ model OrderItem {
|
||||
placementPreviewUrl String? // front design shown composited on the actual product photo, for reference — where does this go when printing
|
||||
placementPreviewUrlBack String? // same, for the back
|
||||
}
|
||||
|
||||
// Audit log for admin logins — tracks when the admin panel is accessed
|
||||
model AdminLoginLog {
|
||||
id String @id @default(cuid())
|
||||
loginAt DateTime @default(now())
|
||||
logoutAt DateTime? // null = still logged in (or session expired without explicit logout)
|
||||
ipAddress String?
|
||||
userAgent String?
|
||||
success Boolean @default(true) // false for failed login attempts
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user