65 lines
2.8 KiB
TypeScript
65 lines
2.8 KiB
TypeScript
// Components
|
|
import { store } from '@/actions/App/Http/Controllers/Auth/PasswordResetLinkController';
|
|
import { login } from '@/routes';
|
|
import { Form, Head } from '@inertiajs/react';
|
|
import { LoaderCircle } from 'lucide-react';
|
|
import { useTranslation } from 'react-i18next';
|
|
|
|
import InputError from '@/components/input-error';
|
|
import TextLink from '@/components/text-link';
|
|
import { Button } from '@/components/ui/button';
|
|
import { Input } from '@/components/ui/input';
|
|
import { Label } from '@/components/ui/label';
|
|
import AuthLayout from '@/layouts/auth-layout';
|
|
|
|
export default function ForgotPassword({ status }: { status?: string }) {
|
|
const { t } = useTranslation('auth');
|
|
return (
|
|
<AuthLayout
|
|
title={t('forgot.title', 'Forgot password')}
|
|
description={t('forgot.description', 'Enter your email to receive a password reset link')}
|
|
name={t('login.brand', 'Die Fotospiel App')}
|
|
logoSrc="/logo-transparent-md.png"
|
|
logoAlt={t('login.logo_alt', 'Logo Die Fotospiel App')}
|
|
>
|
|
<Head title={t('forgot.title', 'Forgot password')} />
|
|
|
|
{status && <div className="mb-4 text-center text-sm font-medium text-green-600">{status}</div>}
|
|
|
|
<div className="space-y-6">
|
|
<Form {...store.form()}>
|
|
{({ processing, errors }) => (
|
|
<>
|
|
<div className="grid gap-2">
|
|
<Label htmlFor="email">{t('forgot.email_label', 'Email address')}</Label>
|
|
<Input
|
|
id="email"
|
|
type="email"
|
|
name="email"
|
|
autoComplete="off"
|
|
autoFocus
|
|
placeholder={t('forgot.email_placeholder', 'name@example.com')}
|
|
/>
|
|
|
|
<InputError message={errors.email} />
|
|
</div>
|
|
|
|
<div className="my-6 flex items-center justify-start">
|
|
<Button className="w-full" disabled={processing}>
|
|
{processing && <LoaderCircle className="h-4 w-4 animate-spin" />}
|
|
{t('forgot.submit', 'Email password reset link')}
|
|
</Button>
|
|
</div>
|
|
</>
|
|
)}
|
|
</Form>
|
|
|
|
<div className="space-x-1 text-center text-sm text-muted-foreground">
|
|
<span>{t('forgot.back_prefix', 'Or, return to')}</span>
|
|
<TextLink href={login()}>{t('forgot.back', 'Login')}</TextLink>
|
|
</div>
|
|
</div>
|
|
</AuthLayout>
|
|
);
|
|
}
|