"use client"; import { useSearchParams } from "next/navigation"; import { InputOTP, InputOTPGroup, InputOTPSlot, } from "@/app/_components/ui/input-otp"; import { SubmitButton } from "@/app/_components/submit-button"; import { Card, CardContent, CardDescription, CardHeader, CardTitle, } from "@/app/_components/ui/card"; import { cn } from "@/app/_lib/utils"; import { useVerifyOtpController } from "@/src/interface-adapters/controllers/auth/verify-otp.controller"; import { Loader2 } from "lucide-react"; import { Controller } from "react-hook-form"; interface VerifyOtpFormProps extends React.HTMLAttributes {} export function VerifyOtpForm({ className, ...props }: VerifyOtpFormProps) { const searchParams = useSearchParams() const email = searchParams.get("email") || "" const { control, register, isPending, handleSubmit, handleOtpChange, errors } = useVerifyOtpController(email) return (
One-Time Password One time password is a security feature that helps protect your data
( handleOtpChange(value, field.onChange)} > {[...Array(6)].map((_, index) => ( ))} )} /> {errors.token ?
{errors.token.message}
:
Successfully verified!
}
Please enter the one-time password sent to {email}.
{isPending ? ( <> Verifying... ) : ( "Verify OTP" )}
By clicking continue, you agree to our Terms of Service and Privacy Policy.
) }