Skip to content

Commit 94fd68e

Browse files
committed
improve username validation
Closes #101
1 parent ce94aa7 commit 94fd68e

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

app/utils/user-validation.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,10 @@ export const usernameSchema = z
44
.string()
55
.min(3, { message: 'Username is too short' })
66
.max(20, { message: 'Username is too long' })
7-
.regex(/^[^@]*$/, 'Username can not contain "@"')
7+
.regex(/^[a-zA-Z0-9_]+$/, {
8+
message: 'Username can only include letters, numbers, and underscores',
9+
})
10+
811
export const passwordSchema = z
912
.string()
1013
.min(6, { message: 'Password is too short' })

0 commit comments

Comments
 (0)