Project-Stage-Academy / UA-1131_Forum-PS

0 stars 0 forks source link

Implement Change Password Functionality #34

Closed mehalyna closed 8 months ago

mehalyna commented 8 months ago

Sub-Tasks:

  1. Create Password Reset API Endpoint:

    • Develop an API endpoint that initiates the password change process. This endpoint should accept the user's email address and generate a password reset request.
  2. Generate Password Reset Token:

    • Generate a secure, time-limited token that will be used to validate the password reset request. This token should be unique and linked to the user's account to prevent misuse.
  3. Send Password Reset Email:

    • Send an email to the user's registered email address containing instructions for resetting their password. This email should include a link with the password reset token as a parameter, directing the user to a password reset page or form.
  4. Validate Password Reset Token:

    • Ensure the validity of the password reset token when the user submits their new password. This includes checking the token's existence, its association with the user, and its expiration time.
  5. Update User Password:

    • Upon successful validation of the password reset token and the new password (including strength validation), update the user's password in the database.
  6. Notify User of Successful Password Reset:

    • Send a confirmation email to the user notifying them that their password has been successfully reset, ensuring the user is aware of the change in case the reset request was not initiated by them.
  7. Secure Handling and Logging:

    • Ensure all operations related to the password reset process are securely handled, including encrypting tokens and passwords. Additionally, maintain logs for password reset requests and changes for auditing purposes.