feat: 管理后台认证加固——改密即失效旧令牌/账号锁定/登录审计/release随机初始密码
This commit is contained in:
1 parent
b76111dfc3
commit
2f0cb71fc2
7 files changed
+127
-11
No files matched your search
@@ -60,3 +60,17 @@ func LogSystemAction(db *gorm.DB, action, targetType string, targetID uint, targ
|
||||
func GetClientIP(c *gin.Context) string {
|
||||
return c.ClientIP()
|
||||
}
|
||||
|
||||
// LogAuthAction 记录认证类日志(登录成功/失败/锁定),登录前无用户上下文,显式传用户名 // Logan.Li
|
||||
func LogAuthAction(db *gorm.DB, c *gin.Context, action, username, detail, result string) {
|
||||
db.Create(&model.AuditLog{
|
||||
Username: username,
|
||||
Action: action,
|
||||
TargetType: "user",
|
||||
TargetName: username,
|
||||
Detail: detail,
|
||||
Result: result,
|
||||
IP: c.ClientIP(),
|
||||
CreatedAt: time.Now(),
|
||||
})
|
||||
}
|
||||
Reference in new issue
Block a user