ForgotPasswordPage.tsx 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. import { Form, Head } from '@inertiajs/react';
  2. import { LoaderCircle } from 'lucide-react';
  3. import PasswordResetLinkController from '@/actions/App/Http/Controllers/Auth/PasswordResetLinkController';
  4. import { InputError } from '@/common/InputError';
  5. import { TextLink } from '@/common/TextLink';
  6. import AuthLayout from '@/pages/layouts/AuthLayout';
  7. import { login } from '@/routes';
  8. import { Button } from '@/shadcn/button';
  9. import { Input } from '@/shadcn/input';
  10. import { Label } from '@/shadcn/label';
  11. export default function ForgotPasswordPage({ status }: { status?: string }) {
  12. return (
  13. <AuthLayout title="Forgot password" description="Enter your email to receive a password reset link">
  14. <Head title="Forgot password" />
  15. {status && <div className="mb-4 text-center text-sm font-medium text-green-600">{status}</div>}
  16. <div className="space-y-6">
  17. <Form {...PasswordResetLinkController.store.form()}>
  18. {({ processing, errors }) => (
  19. <>
  20. <div className="grid gap-2">
  21. <Label htmlFor="email">Email address</Label>
  22. <Input id="email" type="email" name="email" autoComplete="off" autoFocus placeholder="email@example.com" />
  23. <InputError message={errors.email} />
  24. </div>
  25. <div className="my-6 flex items-center justify-start">
  26. <Button className="w-full" disabled={processing}>
  27. {processing && <LoaderCircle className="h-4 w-4 animate-spin" />}
  28. Email password reset link
  29. </Button>
  30. </div>
  31. </>
  32. )}
  33. </Form>
  34. <div className="space-x-1 text-center text-sm text-muted-foreground">
  35. <span>Or, return to</span>
  36. <TextLink href={login()}>log in</TextLink>
  37. </div>
  38. </div>
  39. </AuthLayout>
  40. );
  41. }