import { FormEvent, useState } from "react"; import { Helmet } from "react-helmet"; import { Link } from "@tanstack/react-router"; import { Button, EmailServiceSetupModal, Input } from "@app/components/v2"; import { usePopUp } from "@app/hooks"; import { useSendPasswordResetEmail } from "@app/hooks/api"; import { useFetchServerStatus } from "@app/hooks/api/serverDetails"; export const VerifyEmailPage = () => { const [loading, setLoading] = useState(false); const [email, setEmail] = useState(""); const [step, setStep] = useState(1); const { data: serverDetails } = useFetchServerStatus(); const { handlePopUpToggle, popUp, handlePopUpOpen } = usePopUp(["setUpEmail"] as const); const { mutateAsync } = useSendPasswordResetEmail(); /** * This function sends the verification email and forwards a user to the next step. */ const sendVerificationEmail = async () => { if (email) { try { await mutateAsync({ email }); setStep(2); } catch { setLoading(false); } } }; const onSubmit = (e: FormEvent) => { e.preventDefault(); setLoading(true); if (serverDetails?.emailConfigured) { sendVerificationEmail(); } else { handlePopUpOpen("setUpEmail"); setLoading(false); } }; return (
Reset Password
Infisical Logo
{step === 1 && (

Forgot your password?

Enter your email to start the password reset process.
You will receive an email with instructions.

setEmail(e.target.value)} type="email" placeholder="Enter your email..." isRequired autoComplete="username" className="h-10" />
Back to Login
)} {step === 2 && (

Look for an email in your inbox

If the email is in our system, you will receive an email at{" "} {email} with instructions on how to reset your password.

Back to Login
)} handlePopUpToggle("setUpEmail", isOpen)} />
); };