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:
shirainbown
2026-06-19 18:52:41 +08:00
parent 95b518a139
commit 396783e8a0

View File

@@ -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": "密码修改成功"})
}