From e4a16a86a4119f3ba9b0c4e80502d940110ac69f Mon Sep 17 00:00:00 2001 From: Hariom Balhara Date: Fri, 26 May 2023 13:15:54 +0530 Subject: [PATCH] fix: Broken 2 Factor Authentication (#9139) * Fix 2 Factor Auth * Update apps/web/pages/auth/login.tsx --- apps/web/pages/auth/login.tsx | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/apps/web/pages/auth/login.tsx b/apps/web/pages/auth/login.tsx index 1e6ea5a74f..575b4ce213 100644 --- a/apps/web/pages/auth/login.tsx +++ b/apps/web/pages/auth/login.tsx @@ -51,15 +51,17 @@ export default function Login({ }: inferSSRProps & WithNonceProps) { const { t } = useLocale(); const router = useRouter(); - const formSchema = z.object({ - email: z - .string() - .min(1, `${t("error_required_field")}`) - .email(`${t("enter_valid_email")}`), - password: z.string().min(1, `${t("error_required_field")}`), - }); + const formSchema = z + .object({ + email: z + .string() + .min(1, `${t("error_required_field")}`) + .email(`${t("enter_valid_email")}`), + password: z.string().min(1, `${t("error_required_field")}`), + }) + // Passthrough other fields like totpCode + .passthrough(); const methods = useForm({ resolver: zodResolver(formSchema) }); - const { register, formState } = methods; const [twoFactorRequired, setTwoFactorRequired] = useState(!!totpEmail || false); const [errorMessage, setErrorMessage] = useState(null);