From ce51108f7f3320d8bcb794578a5d0ff805abfd54 Mon Sep 17 00:00:00 2001 From: Pablo Lara Date: Wed, 2 Oct 2024 06:37:29 +0200 Subject: [PATCH] fix: apply password match validation only on sign-up form --- types/authFormSchema.ts | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/types/authFormSchema.ts b/types/authFormSchema.ts index e9190fa75b..7705b2e19f 100644 --- a/types/authFormSchema.ts +++ b/types/authFormSchema.ts @@ -37,7 +37,10 @@ export const authFormSchema = (type: string) => message: "It must contain at least 12 characters.", }), }) - .refine((data) => data.password === data.confirmPassword, { - message: "The password must match", - path: ["confirmPassword"], - }); + .refine( + (data) => type === "sign-in" || data.password === data.confirmPassword, + { + message: "The password must match", + path: ["confirmPassword"], + }, + );