ankitbisen28 / Atelier

Letest web app for custom clothing, Using React vite and Nodejs
https://atelier-client.vercel.app/
0 stars 1 forks source link

Implement "Forget Password" Feature Using Nodemailer #5

Open ankitbisen28 opened 3 months ago

ankitbisen28 commented 3 months ago

Description:

We need to implement a "Forget Password" feature that allows users to reset their passwords if they forget them. This feature should send an email to the user's registered email address with a password reset link. We will use Nodemailer to set up an SMTP server for sending the emails.

Tasks:

  1. Create Password Reset API Endpoint:

    • [ ] Create an API endpoint /api/auth/forgot-password to handle password reset requests.
    • [ ] Validate the email address provided by the user.
    • [ ] Generate a secure token and save it to the database with an expiration time.
  2. Setup Nodemailer:

    • [ ] Install Nodemailer: npm install nodemailer
    • [ ] Configure Nodemailer with SMTP settings (e.g., using Gmail, Mailgun, or any other SMTP service).
  3. Send Password Reset Email:

    • [ ] Create an email template for the password reset email.
    • [ ] Use Nodemailer to send the email with the password reset link, including the secure token in the link.
  4. Create Password Reset Page:

    • [ ] Create a front-end page where users can enter a new password.
    • [ ] Validate the token and ensure it has not expired.
    • [ ] Update the user's password in the database.
  5. Security Considerations:

    • [ ] Ensure the token is securely generated and stored.
    • [ ] Implement rate limiting on the password reset endpoint to prevent abuse.
    • [ ] Ensure the reset link expires after a certain period (e.g., 1 hour).

Additional Information:

References:

Labels:


Please review the tasks and provide any feedback or additional requirements. Once approved, we can start working on this feature.