Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Implemented forgot password. issue: #144 #151

Merged
merged 2 commits into from
Aug 5, 2024

Conversation

kaali001
Copy link
Contributor

Description

This PR introduces a Forgot Password feature to the website, allowing users to reset their passwords by receiving a reset link via email. The main changes include the creation of a ForgotPassword component, integration with the backend API, and user feedback through toast notifications and a confirmation message.

Changes

  1. ForgotPassword Component:

    • Created a new ForgotPassword component using React.
    • Added a form with an email input field for users to request a password reset.
    • Integrated axios for making API requests to the backend.
  2. State Management:

    • Utilized React's useState to manage the email input and success message state.
  3. API Integration:

  4. User Feedback:

    • Integrated react-hot-toast to show toast notifications for success and error messages.
    • Added a success message above the form that informs users to check their email for the reset link upon successful submission.
  5. UI Enhancements:

    • Styled the form and success message to match the existing website design.
    • Used Tailwind CSS classes for consistent styling.

Before:
login

After:
image
image
image

How to test

Before testing , add a valid mail credentials in .env file , mail should be with two-factor-auth on.

  1. Navigate to Login page click on Forgot Password link.
  2. Make sure you created an account with a valid mail address, enter a valid email address in the form and submit.
  3. Verify that a toast notification appears with the success message.
  4. Enter an invalid email or simulate a server error to ensure error handling works correctly and displays an appropriate toast notification.
  5. Check your mail for the reset link, click on that and submit new password.
  6. you are done.

Issue #144: Implement Forgot Password Feature

Copy link
Owner

@dvjsharma dvjsharma left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Few questions, rest looks good.

}
});

const resetUrl = `http://192.168.93.236:5173/reset-password/${token}/${passwd.id}`;
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this URL correct? If so, are we redirecting to a different server?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No It wouldn't, Actuallly react provide us two URL for rendering our site - one is localhost and another for over network.
image

I used 'Network URL ' here because generally multiple gmail accunts signed in the mobile devices, so the reset link which we are sending on user mail will render the reset password page on mobile devices also.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Network URLs are not static :)
They'll change if you switch to a different network. So hard-coding them won't work. IMO keep it localhost because that can be rendered anywhere once the site is deployed and localhost changes to a server address.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I made the changes.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@dvjsharma , merge this PR.

Copy link
Owner

@dvjsharma dvjsharma left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@dvjsharma dvjsharma merged commit e85d996 into dvjsharma:master Aug 5, 2024
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants