From 396783e8a066924a1ffc9acd62fc55fd2ac042a8 Mon Sep 17 00:00:00 2001 From: shirainbown Date: Fri, 19 Jun 2026 18:52:41 +0800 Subject: [PATCH] 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 --- server/handlers/auth.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/server/handlers/auth.go b/server/handlers/auth.go index dd3536f..83a2984 100644 --- a/server/handlers/auth.go +++ b/server/handlers/auth.go @@ -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": "密码修改成功"}) }