import { zodResolver } from "@hookform/resolvers/zod"; import { t, Trans } from "@lingui/macro"; import { ArrowRightIcon } from "@phosphor-icons/react"; import { loginSchema } from "@reactive-resume/dto"; import { usePasswordToggle } from "@reactive-resume/hooks"; import { Alert, AlertTitle, Button, Form, FormControl, FormDescription, FormField, FormItem, FormLabel, FormMessage, Input, } from "@reactive-resume/ui"; import { cn } from "@reactive-resume/utils"; import { useRef } from "react"; import { Helmet } from "react-helmet-async"; import { useForm } from "react-hook-form"; import { Link } from "react-router"; import type { z } from "zod"; import { useLogin } from "@/client/services/auth"; import { useFeatureFlags } from "@/client/services/feature"; type FormValues = z.infer; export const LoginPage = () => { const { login, loading } = useLogin(); const { flags } = useFeatureFlags(); const formRef = useRef(null); usePasswordToggle(formRef); const form = useForm({ resolver: zodResolver(loginSchema), defaultValues: { identifier: "", password: "" }, }); const onSubmit = async (data: FormValues) => { try { await login(data); } catch { form.reset(); } }; return (
{t`Sign in to your account`} - {t`Reactive Resume`}

{t`Sign in to your account`}

{t`Don't have an account?`}
{flags.isEmailAuthDisabled && ( {t`Signing in via email is currently disabled by the administrator.`} )}
( {t`Email`} {t`You can also enter your username.`} )} /> ( {t`Password`} Hold Ctrl to display your password temporarily. )} />
); };