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 : Implement forget password #38

Closed
Niharika0104 opened this issue May 11, 2024 · 24 comments
Closed

feat : Implement forget password #38

Niharika0104 opened this issue May 11, 2024 · 24 comments
Assignees
Labels
GSSoC'24 Under GirlScript Summer of code level3 hard Material ui Material UI is Needed medium medium level implement

Comments

@Niharika0104
Copy link
Contributor

Description:

The application currently lacks the "Forgot Password" feature, which is crucial for user account recovery. This issue is to implement the necessary pages and functionality required for the "Forgot Password" feature.

Tasks:

  1. Create Forgot Password Page: Develop a new page or modal for the "Forgot Password" functionality.

    • Steps to Implement:
      1. Design the user interface for entering email addresses for password reset requests.
      2. Implement the frontend components for the Forgot Password page/modal.
    • Expected Behavior: Users should be able to access the Forgot Password page/modal to initiate the password reset process.
  2. Backend Logic for Password Reset: Develop backend logic to handle password reset requests and send reset instructions to the user's email.

    • Steps to Implement:
      1. Define API endpoints or backend routes to handle password reset requests.
      2. Implement logic to generate and store password reset tokens securely.
      3. Integrate with email services to send password reset instructions to users.
    • Expected Behavior: Upon submitting a password reset request, users should receive instructions on how to reset their passwords via email.
@MAVRICK-1
Copy link
Owner

@Niharika0104 Forget password functionality is already implemented

@Niharika0104
Copy link
Contributor Author

Niharika0104 commented May 11, 2024

@MAVRICK-1 when I click on forget password it's still on the login form.We need to take another form as this might confuse users.If you already have api end points for this and implemented in a fully manner I just make some minor changes as I mentioned.

@MAVRICK-1
Copy link
Owner

@Niharika0104 you can use a modal or where user will enter his/her email or redirect it to the another page where the user will enter it's email

@MAVRICK-1
Copy link
Owner

@Niharika0104 your task is to create that page or modal

@MAVRICK-1 MAVRICK-1 added medium medium level implement Material ui Material UI is Needed GSSoC'24 Under GirlScript Summer of code level3 hard labels May 11, 2024
@Niharika0104
Copy link
Contributor Author

@MAVRICK-1 Thanks I will push the changes as soon as possible

@QQ07
Copy link

QQ07 commented May 12, 2024

If Niharika could not complete this can i do it?

@MAVRICK-1
Copy link
Owner

@Niharika0104 any updates ?

@Niharika0104
Copy link
Contributor Author

I will push the code changes by tomorrow

1 similar comment
@Niharika0104
Copy link
Contributor Author

I will push the code changes by tomorrow

@Niharika0104
Copy link
Contributor Author

@MAVRICK-1 I'm done with resolving the issue.I created page for forget password.And email will be sent if user exists.If user doesn't exists then we need to throw error saying email doesn't exists.But this will not be secure.Do you want me to display that message saying user doesn't exists.I have to use firebase admin api for that.

@Niharika0104
Copy link
Contributor Author

@MAVRICK-1 can you please update me on this?

@Hemu21
Copy link
Contributor

Hemu21 commented May 14, 2024

@Niharika0104 Why you making it complicate. Just use try catch. If mail exist then message goes to mail. if mail not exist then in catch use error.message you will get "Firebase: Error (auth/invalid-credential)" this message. simple slice it and show user to mail is not exist create a accout some thing like that message. I hope you understand. If you unable to implement it mention here. @MAVRICK-1 If @Niharika0104 won't implement this can you please assign this to me.

@Hemu21
Copy link
Contributor

Hemu21 commented May 14, 2024

@Niharika0104 I understand your point. It will not be secure. we have to consider security issues also. So a small suggestion to you. before sending mail. check the mail exists or not. for that you can use signin with mail. then you will get that user exists or not. if exist sent mail else ask for login. I hope you got my point. I am just suggesting you why because website security and data security is also important right. Happy coding. have a good gssoc journey

@Niharika0104
Copy link
Contributor Author

@Hemu21 I'm not making it complicated and irrespective of mail exists or not it's returns undefined.So this is the issue,we are not using signinwithemail method which firebase provides to get that error.Firebase are returning undefined for security reasons.Hope u got

@Hemu21
Copy link
Contributor

Hemu21 commented May 14, 2024

@Niharika0104 did you understand what I am telling?

@Niharika0104
Copy link
Contributor Author

@Hemu21 In signin method we also need to know password dude and in reset password user doesn't know right password.Well I can know the user email exists or not by using firebase admin sdk

@Hemu21
Copy link
Contributor

Hemu21 commented May 14, 2024

@Niharika0104 you can put dummmy or some other string. anyway it's you wish how you implement is. I just gave you a suggestion.

@Niharika0104
Copy link
Contributor Author

@Niharika0104 did you understand what I am telling?

@Hemu21 I know the solution for this issue.I just want to get clarification from @MAVRICK-1 whether this message email doesn't exists is required or not.If it is required then I will add that message using firebase admin sdk else I will ommit and also show that mail has been sent even if user is not registered (and obviously mail won't be sent though)

@MAVRICK-1
Copy link
Owner

MAVRICK-1 commented May 14, 2024

@Hemu21 @Niharika0104 plz don't argue , @Niharika0104 I want something like this Link over here a modal appears , you can redirect to another page also if you want , if the link send to the user it will display link send check your email , if user didn't exist it will show user don't exist

@Niharika0104
Copy link
Contributor Author

@MAVRICK-1 Thanks a lot for clarifying that's exactly why I wanted to hear.So according to the link you provided the password reset mail will be sent irrespective of email is registered or not.I will be doing the same in this application as well.@MAVRICK-1 Congratulations you got accepted into gsoc!

@MAVRICK-1
Copy link
Owner

@Niharika0104 For now we haven't integrated , email authentication till now . So there is no way to know the email really exist or not , If email exist in fire authentication db it will send it to the mail or if not it will return a error . In future i will implement passwordless login , Which will remove this password problem , you can see the feature on the above given website .

@Niharika0104
Copy link
Contributor Author

@MAVRICK-1 it doesn't return error when user doesn't exists🙂and it is always returning undefined.Anyways I will do what's been suggested.Thanks for clarifying again.

@MAVRICK-1
Copy link
Owner

@Niharika0104 link go through the documentation .

@MAVRICK-1
Copy link
Owner

@Niharika0104 https://github.com/MAVRICK-1/e-commerce_website/blob/dev/src/pages/SignIn/index.js#L150-L162 link for forget password function.

Common Errors in sendPasswordResetEmail

Invalid Email

  • Error Code: auth/invalid-email
  • Description: The email address is not valid.
  • Handling: Inform the user that the email address is invalid.

User Not Found

  • Error Code: auth/user-not-found
  • Description: There is no user corresponding to the given email.
  • Handling: Inform the user that there is no account associated with that email address.

Network Error

  • Error Code: auth/network-request-failed
  • Description: A network error occurred (e.g., timeout, DNS error, etc.).
  • Handling: Inform the user to check their internet connection and try again.

Too Many Requests

  • Error Code: auth/too-many-requests
  • Description: Too many requests were sent to the API in a short period.
  • Handling: Inform the user to wait for a while before trying again.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
GSSoC'24 Under GirlScript Summer of code level3 hard Material ui Material UI is Needed medium medium level implement
Projects
None yet
Development

No branches or pull requests

4 participants