feat: 管理后台认证加固——改密即失效旧令牌/账号锁定/登录审计/release随机初始密码
This commit is contained in:
1 parent
b76111dfc3
commit
2f0cb71fc2
7 files changed
+127
-11
No files matched your search
@@ -16,9 +16,14 @@ type User struct {
|
||||
Role string `json:"role" gorm:"size:20;default:'admin'"` // 固定 admin,预留扩展
|
||||
IsActive bool `json:"is_active" gorm:"default:true"`
|
||||
LastLogin *time.Time `json:"last_login,omitempty"`
|
||||
CreatedAt time.Time `json:"created_at"`
|
||||
UpdatedAt time.Time `json:"updated_at"`
|
||||
DeletedAt gorm.DeletedAt `json:"deleted_at,omitempty" gorm:"index"`
|
||||
// 会话失效基线:签发时间早于该值的 JWT 一律拒绝(改密码时刷新为当前时间) // Logan.Li
|
||||
TokenValidAfter time.Time `json:"-" gorm:"default:CURRENT_TIMESTAMP"`
|
||||
// 账号级登录防护:连续失败计数与锁定截止时间 // Logan.Li
|
||||
FailedLoginAttempts int `json:"-" gorm:"default:0"`
|
||||
LockedUntil *time.Time `json:"-" gorm:"default:null"`
|
||||
CreatedAt time.Time `json:"created_at"`
|
||||
UpdatedAt time.Time `json:"updated_at"`
|
||||
DeletedAt gorm.DeletedAt `json:"deleted_at,omitempty" gorm:"index"`
|
||||
}
|
||||
|
||||
// TableName 指定表名 // Logan.Li
|
||||
|
||||
Reference in new issue
Block a user