Browse Source

fix: add trim() to username validation to prevent whitespace-only values

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
feat/registration-page
npmrun 2 weeks ago
parent
commit
d669977f9a
  1. 1
      server/utils/auth/validation.ts

1
server/utils/auth/validation.ts

@ -4,6 +4,7 @@ export const registerSchema = z
.object({ .object({
username: z username: z
.string() .string()
.trim()
.min(3, '用户名至少需要3个字符') .min(3, '用户名至少需要3个字符')
.max(30, '用户名最多30个字符'), .max(30, '用户名最多30个字符'),
password: z.string().min(8, '密码至少需要8个字符'), password: z.string().min(8, '密码至少需要8个字符'),

Loading…
Cancel
Save