feat(auth): signupm, forgot passowrd, reset password all added

This commit is contained in:
2025-09-25 15:42:35 -05:00
parent a30fa8c9f4
commit 86dea6083e
34 changed files with 3698 additions and 49 deletions

View File

@@ -0,0 +1,88 @@
import { LstCard } from "../../../components/ui/lstCard";
import {
CardContent,
CardDescription,
CardHeader,
CardTitle,
} from "../../../components/ui/card";
import { useAppForm } from "../../../lib/formStuff";
import { api } from "../../../lib/axiosAPI";
import { toast } from "sonner";
import { Link } from "@tanstack/react-router";
export default function RequestResetPassword() {
const form = useAppForm({
defaultValues: {
email: "",
},
onSubmit: async ({ value }) => {
try {
const res = await api.post("api/user/resetpassword", {
email: value.email,
});
console.log(res);
if (res.status === 200) {
toast.success(
res.data.message
? res.data.message
: "If this email exists in our system, check your email for the reset link"
);
}
} catch (error) {
console.log(error);
}
},
});
return (
<div className="">
<LstCard className="p-6 w-96">
<CardHeader>
<CardTitle>Reset your password</CardTitle>
<CardDescription>
Enter your email address and well send you a reset link
</CardDescription>
</CardHeader>
<CardContent>
<form
onSubmit={(e) => {
e.preventDefault();
form.handleSubmit();
}}
>
<form.AppField
name="email"
children={(field) => (
<field.InputField
label="Email address"
inputType="email"
required={true}
/>
)}
/>
<div className="flex justify-end mt-6">
<form.AppForm>
<form.SubmitButton>
Send Reset Link
</form.SubmitButton>
</form.AppForm>
</div>
</form>
<div className="mt-6 text-center text-sm text-gray-600">
Remembered your password?{" "}
<Link
to="/login"
className="text-primary underline underline-offset-4 hover:text-primary/80"
>
Back to login
</Link>
</div>
</CardContent>
</LstCard>
</div>
);
}