From d669977f9ac4b5503b110613fbb966e9d1d023c0 Mon Sep 17 00:00:00 2001 From: npmrun <1549469775@qq.com> Date: Fri, 15 May 2026 10:33:05 +0800 Subject: [PATCH] fix: add trim() to username validation to prevent whitespace-only values Co-Authored-By: Claude Opus 4.7 --- server/utils/auth/validation.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/server/utils/auth/validation.ts b/server/utils/auth/validation.ts index dd5b20a..0b0f744 100644 --- a/server/utils/auth/validation.ts +++ b/server/utils/auth/validation.ts @@ -4,6 +4,7 @@ export const registerSchema = z .object({ username: z .string() + .trim() .min(3, '用户名至少需要3个字符') .max(30, '用户名最多30个字符'), password: z.string().min(8, '密码至少需要8个字符'),