import { zodResolver } from "@hookform/resolvers/zod"; import { t } from "@lingui/macro"; import { ArrowRight } from "@phosphor-icons/react"; import { twoFactorSchema } from "@reactive-resume/dto"; import { usePasswordToggle } from "@reactive-resume/hooks"; import { Button, Form, FormControl, FormField, FormItem, FormLabel, FormMessage, Input, } from "@reactive-resume/ui"; import { useRef } from "react"; import { Helmet } from "react-helmet-async"; import { useForm } from "react-hook-form"; import { Link, useNavigate } from "react-router"; import type { z } from "zod"; import { useVerifyOtp } from "@/client/services/auth"; type FormValues = z.infer; export const VerifyOtpPage = () => { const navigate = useNavigate(); const { verifyOtp, loading } = useVerifyOtp(); const formRef = useRef(null); usePasswordToggle(formRef); const form = useForm({ resolver: zodResolver(twoFactorSchema), defaultValues: { code: "" }, }); const onSubmit = async (data: FormValues) => { try { await verifyOtp(data); void navigate("/dashboard"); } catch { form.reset(); } }; return (
{t`Two-Factor Authentication`} - {t`Reactive Resume`}

{t`Two-Factor Authentication`}

{t`Enter the one-time password provided by your authenticator app below.`}
( {t`One-Time Password`} )} />
); };