67 lines
2.2 KiB
TypeScript
67 lines
2.2 KiB
TypeScript
import GuestLayout from "@/layouts/guest-layout";
|
|
import { Head, useForm } from "@inertiajs/react";
|
|
import { FormEventHandler } from "react";
|
|
import { Input } from "@/components/ui/input";
|
|
import { InputError } from "@/components/ui/input-error";
|
|
import { Button } from "@/components/ui/button";
|
|
import {
|
|
Card,
|
|
CardContent,
|
|
CardDescription,
|
|
CardFooter,
|
|
CardHeader,
|
|
} from "@/components/ui/card";
|
|
|
|
export default function ForgotPassword({ status }: { status?: string }) {
|
|
const { data, setData, post, processing, errors } = useForm({
|
|
email: "",
|
|
});
|
|
|
|
const submit: FormEventHandler = (e) => {
|
|
e.preventDefault();
|
|
|
|
post(route("password.email"));
|
|
};
|
|
|
|
return (
|
|
<GuestLayout>
|
|
<Head title="Forgot Password" />
|
|
|
|
<form onSubmit={submit}>
|
|
<Card>
|
|
<CardHeader>
|
|
<CardDescription>
|
|
Forgot your password? No problem. Just let us know
|
|
your email address and we will email you a password
|
|
reset link that will allow you to choose a new one.
|
|
</CardDescription>
|
|
</CardHeader>
|
|
<CardContent>
|
|
{status && (
|
|
<div className="mb-4 font-medium text-sm text-green-600">
|
|
{status}
|
|
</div>
|
|
)}
|
|
<Input
|
|
id="email"
|
|
type="email"
|
|
name="email"
|
|
placeholder="Your email"
|
|
value={data.email}
|
|
onChange={(e) => setData("email", e.target.value)}
|
|
/>
|
|
|
|
<InputError message={errors.email} className="mt-2" />
|
|
</CardContent>
|
|
|
|
<CardFooter className="flex justify-end">
|
|
<Button disabled={processing}>
|
|
Email Password Reset Link
|
|
</Button>
|
|
</CardFooter>
|
|
</Card>
|
|
</form>
|
|
</GuestLayout>
|
|
);
|
|
}
|