import { FC } from "react"; import { useForm, Controller } from "react-hook-form"; // ui import { Input, Button } from "@plane/ui"; // icons import { XCircle } from "lucide-react"; // services import { AuthService } from "services/auth.service"; const authService = new AuthService(); // hooks import useToast from "hooks/use-toast"; export interface InstanceSetupEmailFormValues { email: string; } export interface IInstanceSetupEmailForm { handleNextStep: (email: string) => void; } export const InstanceSetupEmailForm: FC = (props) => { const { handleNextStep } = props; // form info const { control, handleSubmit, setValue, reset, formState: { isSubmitting }, } = useForm({ defaultValues: { email: "", }, }); // hooks const { setToastAlert } = useToast(); const handleEmailFormSubmit = (formValues: InstanceSetupEmailFormValues) => authService .instanceAdminEmailCode({ email: formValues.email }) .then(() => { reset(); handleNextStep(formValues.email); }) .catch((err) => { setToastAlert({ type: "error", title: "Error!", message: err?.error ?? "Something went wrong. Please try again.", }); }); return (

Let{"'"}s secure your instance

Explore privacy options. Get AI features. Secure access.
Takes 2 minutes.

/^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/.test( value ) || "Email address is not valid", }} render={({ field: { value, onChange } }) => (
{value.length > 0 && ( setValue("email", "")} /> )}
)} />

Use your email address if you are the instance admin.
Use your admin’s e-mail if you are not.

); };