Skip to content

Scheduling infrastructure for absolutely everyone.

fix: Broken 2 Factor Authentication (#9139)

Hariom Balhara6f338b6fc7ea
diff --git a/apps/web/pages/auth/login.tsx b/apps/web/pages/auth/login.tsx
index 1e6ea5a74fb..575b4ce213e 100644
--- a/apps/web/pages/auth/login.tsx
+++ b/apps/web/pages/auth/login.tsx
@@ -51,15 +51,17 @@ export default function Login({
}: inferSSRProps<typeof _getServerSideProps> & 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<LoginValues>({ resolver: zodResolver(formSchema) });
-
const { register, formState } = methods;
const [twoFactorRequired, setTwoFactorRequired] = useState(!!totpEmail || false);
const [errorMessage, setErrorMessage] = useState<string | null>(null);