fix: Broken 2 Factor Authentication (#9139)

* Fix 2 Factor Auth

* Update apps/web/pages/auth/login.tsx
This commit is contained in:
Hariom Balhara 2023-05-26 13:15:54 +05:30 committed by GitHub
parent e760122db6
commit e4a16a86a4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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);