import { NextPage } from "next"; import Image from "next/image"; import Link from "next/link"; import { useRouter } from "next/router"; import { useTheme } from "next-themes"; import { Controller, useForm } from "react-hook-form"; import { Lightbulb } from "lucide-react"; // services import { Button, Input } from "@plane/ui"; import { checkEmailValidity } from "@/helpers/string.helper"; import { AuthService } from "@/services/authentication.service"; // hooks import useSignInRedirection from "hooks/use-sign-in-redirection"; import useToast from "hooks/use-toast"; // ui // images import latestFeatures from "public/onboarding/onboarding-pages.svg"; import BluePlaneLogoWithoutText from "public/plane-logos/blue-without-text-new.png"; // helpers type TResetPasswordFormValues = { email: string; password: string; }; const defaultValues: TResetPasswordFormValues = { email: "", password: "", }; // services const authService = new AuthService(); const HomePage: NextPage = () => { // router const router = useRouter(); const { uidb64, token, email } = router.query; // next-themes const { resolvedTheme } = useTheme(); // toast const { setToastAlert } = useToast(); // sign in redirection hook const { handleRedirection } = useSignInRedirection(); // form info const { control, formState: { errors, isSubmitting, isValid }, handleSubmit, } = useForm({ defaultValues: { ...defaultValues, email: email?.toString() ?? "", }, }); const handleResetPassword = async (formData: TResetPasswordFormValues) => { if (!uidb64 || !token || !email) return; const payload = { new_password: formData.password, }; await authService .resetPassword(uidb64.toString(), token.toString(), payload) .then(() => handleRedirection()) .catch((err) => setToastAlert({ type: "error", title: "Error!", message: err?.error ?? "Something went wrong. Please try again.", }) ); }; return (
Plane Logo Plane

Let{"'"}s get a new password

checkEmailValidity(value) || "Email is invalid", }} render={({ field: { value, onChange, ref } }) => ( )} />
( )} />

Whatever you choose now will be your account{"'"}s password until you change it.

When you click the button above, you agree with our{" "} terms and conditions of service.

Try the latest features, like Tiptap editor, to write compelling responses.{" "} See new features

Plane Issues
); }; export default HomePage;