fix: add operation log for password change
- ChangePassword handler now records 'change_password' action in operation_logs - Logs include username, source IP, and timestamp for audit purposes
This commit is contained in:
@@ -84,6 +84,11 @@ func (h *AuthHandler) ChangePassword(c *gin.Context) {
|
||||
}
|
||||
|
||||
h.Cfg.AdminPass = string(hashed)
|
||||
|
||||
// 记录密码修改日志
|
||||
var entityID int64 = 0
|
||||
middleware.LogOperation("change_password", "user", &entityID, h.Cfg.AdminUser, "", "", c.ClientIP(), h.Cfg.AdminUser)
|
||||
|
||||
c.JSON(http.StatusOK, gin.H{"message": "密码修改成功"})
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user