2024-06-29 05:22:22 +00:00
|
|
|
"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 (
|
2024-08-17 01:46:43 +00:00
|
|
|
<main className="mx-auto flex h-screen max-w-xl flex-col justify-center px-4">
|
|
|
|
<Card className="flex flex-col gap-4 p-6">
|
2024-06-29 05:22:22 +00:00
|
|
|
<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>
|
2024-08-17 01:46:43 +00:00
|
|
|
<Link href="/" className="flex items-center text-sm">
|
2024-06-29 05:22:22 +00:00
|
|
|
<ArrowLeftSquare />
|
2024-08-17 01:46:43 +00:00
|
|
|
<span className="pl-2">Return to Login</span>
|
2024-06-29 05:22:22 +00:00
|
|
|
</Link>
|
|
|
|
</form>
|
|
|
|
</Card>
|
|
|
|
</main>
|
|
|
|
);
|
|
|
|
}
|