cyrillic email regex
This commit is contained in:
@@ -16,13 +16,21 @@ export type FormAction = (
|
|||||||
formData: FormData
|
formData: FormData
|
||||||
) => Promise<FormState>
|
) => Promise<FormState>
|
||||||
|
|
||||||
|
const emailRegex = /^([a-zA-Z0-9.\-_]+|[а-яА-ЯёЁ0-9.\-_]+)@(([a-zA-Z0-9.\-]+)\.([a-zA-Z]{2,})|([a-zA-Z0-9.\-]+)\.([а-яА-ЯёЁ]{2,})|([а-яА-ЯёЁ0-9.\-]+)\.([a-zA-Z]{2,})|([а-яА-ЯёЁ0-9.\-]+)\.([а-яА-ЯёЁ]{2,}))$/i;
|
||||||
|
|
||||||
export const SignupFormSchema = z
|
export const SignupFormSchema = z
|
||||||
.object({
|
.object({
|
||||||
full_name: z
|
full_name: z
|
||||||
.string()
|
.string()
|
||||||
.min(3, { error: 'register-error-name' })
|
.min(3, { error: 'register-error-name' })
|
||||||
.trim(),
|
.trim(),
|
||||||
email: z.email({ error: 'register-error-valid-email' }).trim(),
|
email: z
|
||||||
|
.string()
|
||||||
|
.trim()
|
||||||
|
.refine(
|
||||||
|
(value) => emailRegex.test(value),
|
||||||
|
{ message: 'register-error-valid-email' }
|
||||||
|
),
|
||||||
phone: z
|
phone: z
|
||||||
.string()
|
.string()
|
||||||
.min(12, { error: 'register-error-phone' }),
|
.min(12, { error: 'register-error-phone' }),
|
||||||
|
|||||||
Reference in New Issue
Block a user