refactor(server/auth): 移除账号掩码函数并简化审计日志存储

1.  移除不再使用的maskLoginAccount工具函数
2.  登录审计日志直接存储原始账号而非掩码后的版本
3.  重命名测试函数以匹配新的业务逻辑
This commit is contained in:
Austin
2026-09-21 17:50:55 +08:00
parent 55c59878cf
commit 9820e89e1c
2 changed files with 3 additions and 32 deletions
+1 -12
View File
@@ -22,18 +22,7 @@ func TestLoginAuditAccountDoesNotTreatTokenAsAccount(t *testing.T) {
}
}
func TestMaskAndHashLoginAccount(t *testing.T) {
tests := map[string]string{
"13800138000": "138****8000",
"alice@example.com": "a***@example.com",
"alice": "a***e",
"ab": "**",
}
for input, want := range tests {
if got := maskLoginAccount(input); got != want {
t.Errorf("maskLoginAccount(%q)=%q want %q", input, got, want)
}
}
func TestHashLoginAccount(t *testing.T) {
hash := hashLoginAccount(" Alice ")
if len(hash) != 64 || hash != hashLoginAccount("alice") || strings.Contains(hash, "alice") {
t.Fatalf("unexpected account hash %q", hash)