Add email field and add it to register logic

This commit is contained in:
2024-10-27 17:25:45 +01:00
parent 6a1823586a
commit 8f8f019ab7
6 changed files with 31 additions and 4 deletions

View File

@ -20,6 +20,11 @@ export const registerAccountSchema = z.object({
.min(3, { message: 'Name must be at least 3 characters long' })
.max(255, { message: 'Name must be at most 255 characters long' })
.regex(/^[A-Za-z][A-Za-z0-9_-]*$/, { message: 'Name must start with a letter and can only contain letters, numbers, underscores, or dashes' }),
email: z
.string()
.min(3, { message: 'Email must be at least 3 characters long' })
.max(255, { message: 'Email must be at most 255 characters long' })
.regex(/^[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,}$/, { message: 'Email must be valid' }),
password: z
.string()
.min(8, {