-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Added a reset password form with three inputs: `old password`, `new password`, and `confirm password`. - Included a submit button to handle form submission for the password reset. - Ensured validation for new password and confirm password fields to match. - Applied basic styling consistent with the current design.
- Loading branch information
1 parent
a9a085f
commit ab1024b
Showing
7 changed files
with
127 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
56 changes: 56 additions & 0 deletions
56
client/src/pages/reset-password/_components/reset-password-form.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
import { useMutation } from "@tanstack/react-query"; | ||
import { FormEvent, useState } from "react"; | ||
|
||
import { RESET_PASSWORD_INPUTS } from "@/constants/collections"; | ||
import { RESETPASSWORDKEY } from "@/constants/keys"; | ||
import { Button } from "@/components/text-button"; | ||
import { Input } from "@/components/input"; | ||
|
||
const ResetPasswordForm = () => { | ||
const [confirmPassword, setConfirmPassword] = useState(""); | ||
const { isPending } = useMutation({ | ||
mutationKey: [RESETPASSWORDKEY], | ||
}); | ||
|
||
const onSubmit = (e: FormEvent<HTMLFormElement>) => { | ||
e.preventDefault(); | ||
}; | ||
|
||
return ( | ||
<form | ||
onSubmit={onSubmit} | ||
className="p-4 lg:p-6 w-full md:w-fit rounded-md border border-primary/50 bg-primary/15 drop-shadow-2xl space-y-4 lg:space-y-6" | ||
> | ||
{RESET_PASSWORD_INPUTS.map((r) => ( | ||
<Input | ||
key={r.label} | ||
required | ||
disabled={isPending} | ||
{...r} | ||
validation={(value) => { | ||
if (r.name === "new-password") { | ||
setConfirmPassword(value); | ||
} | ||
if (r.name === undefined) { | ||
return r.validation({ | ||
pass1: value, | ||
pass2: confirmPassword, | ||
}); | ||
} | ||
|
||
return r.validation(value); | ||
}} | ||
/> | ||
))} | ||
|
||
<Button | ||
label="Sign In" | ||
disabled={isPending} | ||
loading={isPending} | ||
type="submit" | ||
/> | ||
</form> | ||
); | ||
}; | ||
|
||
export { ResetPasswordForm }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import { ResetPasswordForm } from "./_components/reset-password-form"; | ||
|
||
const ResetPasswordPage = () => { | ||
return ( | ||
<section className="px-4 lg:px-0 h-full flex-center flex-col gap-y-6 w-fit mx-auto"> | ||
<h2 | ||
className="text-lg lg:text-2xl font-extrabold text-center uppercase w-full | ||
rounded-md border border-primary/50 bg-primary/15 drop-shadow-2xl p-4" | ||
> | ||
Reset Password | ||
</h2> | ||
|
||
<ResetPasswordForm /> | ||
</section> | ||
); | ||
}; | ||
|
||
export { ResetPasswordPage }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters