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: Password Reset Email For Users #149

Closed
wants to merge 0 commits into from

Conversation

Waptech07
Copy link
Contributor

This PR contains the implementation of [POST] /api/v1/auth/password-reset-email [UNPROTECTED Endpoint]

Description

Added functionality for sending password reset emails. This includes creating a new endpoint /password-reset-email, a utility function to generate reset tokens, and integration with an email service to send the password reset email. The email contains a secure link for users to reset their passwords.

Related Issue (Link to issue ticket)

This is an implementation of an open issue #51

​## Addition
I added fastapi-mail dependency to the requirements.txt file. fastapi-mail is required for sending of emails.

Motivation and Context

This change is required to allow users to reset their passwords securely if they forget them. It enhances the security and user experience of the application.

How Has This Been Tested?

The new functionality has been tested using pytest, httpx, and Postman. Tests include:

  • Sending a password reset email to an existing user.
  • Handling a request to send a password reset email to a non-existent user.

Test environment:

  • PostgreSQL database for storing user information.
  • Async testing setup using FastAPI, httpx, and pytest.

Screenshots (if appropriate - Postman, Fast API, etc):

Successful Response

image

Error Response

image

Fast API

image

image

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have read the CONTRIBUTING document.
  • I have added tests to cover my changes.
  • All new and existing tests passed.

@Waptech07 Waptech07 changed the title Password reset Password Reset Email For Users Jul 21, 2024
@Waptech07 Waptech07 changed the title Password Reset Email For Users Feat: Password Reset Email For Users Jul 21, 2024
tests/v1/test_password_reset_email.py Outdated Show resolved Hide resolved
api/v1/routes/auth.py Outdated Show resolved Hide resolved
api/core/email.py Outdated Show resolved Hide resolved
@Waptech07
Copy link
Contributor Author

All changes requested has been resolved.

@bolexs
Copy link
Contributor

bolexs commented Jul 21, 2024

@Dev-wonderful asides the conflict are you good with the work done so far here

bolexs
bolexs previously approved these changes Jul 21, 2024
Copy link
Contributor

@bolexs bolexs left a comment

Choose a reason for hiding this comment

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

good work @Waptech07

@Waptech07
Copy link
Contributor Author

Thanks @bolexs

Dev-wonderful
Dev-wonderful previously approved these changes Jul 21, 2024
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.

3 participants