import { FC } from "react"; import { useForm, Controller } from "react-hook-form"; // mobx store import { useMobxStore } from "lib/mobx/store-provider"; // 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"; // helpers import { checkEmailValidity } from "helpers/string.helper"; interface InstanceSetupEmailFormValues { email: string; password: string; } export interface IInstanceSetupEmailForm { handleNextStep: (email: string) => void; } export const InstanceSetupSignInForm: FC = (props) => { const { handleNextStep } = props; const { user: { fetchCurrentUser }, } = useMobxStore(); // form info const { control, formState: { errors, isSubmitting }, handleSubmit, setValue, } = useForm({ defaultValues: { email: "", password: "", }, }); // hooks const { setToastAlert } = useToast(); const handleFormSubmit = async (formValues: InstanceSetupEmailFormValues) => { const payload = { email: formValues.email, password: formValues.password, }; await authService .instanceAdminSignIn(payload) .then(async () => { await fetchCurrentUser(); 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.

checkEmailValidity(value) || "Email is invalid", }} 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.

); };