Skip to content

Commit

Permalink
feat: added toast check for the email and removed unnecessary inputs
Browse files Browse the repository at this point in the history
resolve #97
  • Loading branch information
mohamedhadri committed Aug 31, 2022
1 parent 8a19cff commit 2a56dc4
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 23 deletions.
22 changes: 13 additions & 9 deletions src/components/EditProfile/EditProfile.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,18 @@ export default function EditProfile() {
.catch(() => {});
};

const resetUserPassword = async () => {
await resetPassword(emailRef.current.value);
console.log("check your inbox for futher instructions");
const resetUserPassword = async (event) => {
event.preventDefault();

await resetPassword(emailRef.current.value)
.then(() => {
toast.success(
t(
"Check your inbox we Sent you a link to reset your password"
) + "!"
);
})
.catch(() => {});
};

return (
Expand Down Expand Up @@ -70,11 +79,6 @@ export default function EditProfile() {
ref={emailRef}
/>

<Input type='password' placeholder={t("password")} />
<Input
type='password'
placeholder={t("confirm-new-password")}
/>
<div className='flex h-48 items-stretch'>
<Input type='text' placeholder={t("address")} />
</div>
Expand All @@ -93,7 +97,7 @@ export default function EditProfile() {
<Button
buttonStyle='saveChanges'
type='button'
text={t("reset password")}
text='reset password'
handleClick={resetUserPassword}
/>
</a>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,20 +22,6 @@ exports[`renders correctly 1`] = `
placeholder="Enter Email to Reset Your password"
type="email"
/>
<input
className=" inputtabfont my-3.5 block w-full rounded-lg border border-gray-300 bg-gray-50 p-2.5 text-center text-xl text-hadrisblue placeholder-hadrisblue focus:border-blue-500 focus:ring-purple"
id="password"
placeholder="password"
required={true}
type="password"
/>
<input
className=" inputtabfont my-3.5 block w-full rounded-lg border border-gray-300 bg-gray-50 p-2.5 text-center text-xl text-hadrisblue placeholder-hadrisblue focus:border-blue-500 focus:ring-purple"
id="password"
placeholder="confirm-new-password"
required={true}
type="password"
/>
<div
className="flex h-48 items-stretch"
>
Expand Down

0 comments on commit 2a56dc4

Please sign in to comment.