2024-03-14 15:41:48 +00:00
|
|
|
|
import type { MetaFunction } from "@remix-run/node";
|
|
|
|
|
import { Link } from "@remix-run/react";
|
|
|
|
|
import { Button } from "~/components/ui/button";
|
|
|
|
|
import logoPng from "~/images/lume-logo.png?url";
|
|
|
|
|
import lumeColorLogoPng from "~/images/lume-color-logo.png?url";
|
|
|
|
|
import discordLogoPng from "~/images/discord-logo.png?url";
|
|
|
|
|
import lumeBgPng from "~/images/lume-bg-image.png?url";
|
|
|
|
|
import { Field } from "~/components/forms";
|
|
|
|
|
import { getFormProps, useForm } from "@conform-to/react";
|
|
|
|
|
import { z } from "zod";
|
|
|
|
|
import { getZodConstraint, parseWithZod } from "@conform-to/zod";
|
2024-03-19 15:38:42 +00:00
|
|
|
|
import { ToastAction } from "~/components/ui/toast";
|
|
|
|
|
import { useNotification } from "@refinedev/core";
|
2024-03-07 14:04:59 +00:00
|
|
|
|
|
|
|
|
|
export const meta: MetaFunction = () => {
|
2024-03-14 15:41:48 +00:00
|
|
|
|
return [{ title: "Sign Up" }];
|
|
|
|
|
};
|
2024-03-07 14:04:59 +00:00
|
|
|
|
|
2024-03-14 15:41:48 +00:00
|
|
|
|
const RecoverPasswordSchema = z.object({
|
|
|
|
|
email: z.string().email(),
|
|
|
|
|
});
|
2024-03-07 14:04:59 +00:00
|
|
|
|
export default function RecoverPassword() {
|
2024-03-19 15:38:42 +00:00
|
|
|
|
const { open } = useNotification();
|
2024-03-07 14:04:59 +00:00
|
|
|
|
const [form, fields] = useForm({
|
|
|
|
|
id: "sign-up",
|
|
|
|
|
constraint: getZodConstraint(RecoverPasswordSchema),
|
|
|
|
|
onValidate({ formData }) {
|
2024-03-14 15:41:48 +00:00
|
|
|
|
return parseWithZod(formData, { schema: RecoverPasswordSchema });
|
|
|
|
|
},
|
2024-03-19 01:41:21 +00:00
|
|
|
|
onSubmit(e) {
|
|
|
|
|
e.preventDefault();
|
2024-03-19 15:38:42 +00:00
|
|
|
|
open?.({
|
|
|
|
|
type: "success",
|
|
|
|
|
message: "Password reset email sent",
|
2024-03-19 01:41:21 +00:00
|
|
|
|
description: "Check your email for a link to reset your password. If it doesn’t appear within a few minutes, check your spam folder.",
|
2024-03-19 15:38:42 +00:00
|
|
|
|
action: <ToastAction altText="Cancel">Cancel</ToastAction>,
|
|
|
|
|
cancelMutation: () => {
|
|
|
|
|
console.log("cancel mutation");
|
|
|
|
|
},
|
|
|
|
|
})
|
|
|
|
|
|
2024-03-19 01:41:21 +00:00
|
|
|
|
}
|
2024-03-14 15:41:48 +00:00
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
// TODO: another detail is the reset password has no screen to either accept a new pass or
|
|
|
|
|
// just say an email has been sent.. if i were to generate a pass for them. imho i think
|
|
|
|
|
// a screen that just says a password reset email has been sent would be good, then a separate
|
|
|
|
|
// route to accept the reset token and send that to the api when would then trigger a new email
|
|
|
|
|
// with the pass.
|
2024-03-07 14:04:59 +00:00
|
|
|
|
|
|
|
|
|
return (
|
|
|
|
|
<div className="p-10 h-screen relative">
|
|
|
|
|
<header>
|
|
|
|
|
<img src={logoPng} alt="Lume logo" className="h-10" />
|
|
|
|
|
</header>
|
|
|
|
|
<form
|
|
|
|
|
className="w-full p-2 max-w-md space-y-4 mt-12 bg-background"
|
2024-03-14 15:41:48 +00:00
|
|
|
|
{...getFormProps(form)}>
|
2024-03-07 14:04:59 +00:00
|
|
|
|
<span className="!mb-12 space-y-2">
|
|
|
|
|
<h2 className="text-3xl font-bold">Reset your password</h2>
|
|
|
|
|
</span>
|
|
|
|
|
<Field
|
|
|
|
|
inputProps={{ name: fields.email.name }}
|
|
|
|
|
labelProps={{ children: "Email Address" }}
|
|
|
|
|
errors={fields.email.errors}
|
|
|
|
|
/>
|
2024-03-13 17:35:42 +00:00
|
|
|
|
<Button className="w-full h-14">Reset Password</Button>
|
2024-03-07 14:04:59 +00:00
|
|
|
|
<p className="text-input-placeholder w-full text-left">
|
|
|
|
|
<Link
|
|
|
|
|
to="/login"
|
2024-03-14 15:41:48 +00:00
|
|
|
|
className="text-primary-1 text-md hover:underline hover:underline-offset-4">
|
2024-03-13 17:35:42 +00:00
|
|
|
|
← Back to Login
|
2024-03-07 14:04:59 +00:00
|
|
|
|
</Link>
|
|
|
|
|
</p>
|
|
|
|
|
</form>
|
|
|
|
|
<div className="fixed inset-0 -z-10 overflow-clip">
|
|
|
|
|
<img
|
|
|
|
|
src={lumeBgPng}
|
|
|
|
|
alt="Lume background"
|
|
|
|
|
className="absolute top-0 right-0 md:w-2/3 object-cover z-[-1]"
|
|
|
|
|
/>
|
|
|
|
|
</div>
|
|
|
|
|
<footer className="my-5">
|
|
|
|
|
<ul className="flex flex-row">
|
|
|
|
|
<li>
|
|
|
|
|
<Link to="https://discord.lumeweb.com">
|
|
|
|
|
<Button
|
|
|
|
|
variant={"link"}
|
2024-03-14 15:41:48 +00:00
|
|
|
|
className="flex flex-row gap-x-2 text-input-placeholder">
|
2024-03-07 14:04:59 +00:00
|
|
|
|
<img className="h-5" src={discordLogoPng} alt="Discord Logo" />
|
|
|
|
|
Connect with us
|
|
|
|
|
</Button>
|
|
|
|
|
</Link>
|
|
|
|
|
</li>
|
|
|
|
|
<li>
|
|
|
|
|
<Link to="https://lumeweb.com">
|
|
|
|
|
<Button
|
|
|
|
|
variant={"link"}
|
2024-03-14 15:41:48 +00:00
|
|
|
|
className="flex flex-row gap-x-2 text-input-placeholder">
|
2024-03-07 14:04:59 +00:00
|
|
|
|
<img className="h-5" src={lumeColorLogoPng} alt="Lume Logo" />
|
|
|
|
|
Connect with us
|
|
|
|
|
</Button>
|
|
|
|
|
</Link>
|
|
|
|
|
</li>
|
|
|
|
|
</ul>
|
|
|
|
|
</footer>
|
|
|
|
|
</div>
|
2024-03-14 15:41:48 +00:00
|
|
|
|
);
|
2024-03-07 14:04:59 +00:00
|
|
|
|
}
|