daphnis/app/(password-reset)/forgot-password/page.tsx
2024-06-29 01:22:22 -04:00

44 lines
1.4 KiB
TypeScript

"use client";
import Link from "next/link";
import { useState } from "react";
import { ArrowLeftSquare } from "lucide-react";
import { Card } from "@/components/ui/card";
import { Input } from "@/components/ui/input";
import { Button } from "@/components/ui/button";
import { EmailPasswordResetLink } from "./emailforgotpassword";
export default function ForgotPassword() {
const [error, setError] = useState<string>("");
const submit = async (data: FormData) => {
const { error } = await EmailPasswordResetLink(data);
setError(error);
};
return (
<main className="max-w-xl px-4 mx-auto flex flex-col justify-center h-screen ">
<Card className="gap-4 flex flex-col p-6 ">
<form action={submit} className="flex flex-col gap-4">
{" "}
<h1 className="text-2xl font-light">Reset password</h1>
<p>
Enter your email address to get instructions for resetting your
password.
</p>
<Input name="email" type="email" placeholder="Your email..." />
{error && <p className="text-red-500">{error}</p>}
<Button type="submit">Reset Password</Button>
<Link
href="/"
className="text-sm text-neutral-700/80 flex items-center"
>
<ArrowLeftSquare />
<span>Return to Login</span>
</Link>
</form>
</Card>
</main>
);
}