Search⌘ K
AI Features

Password Reset Endpoint

Explore how to create password reset endpoints that allow users to request reset links via email, validate tokens, and set new passwords. Understand the flow of secure password resets and practice implementing and testing these endpoints in Django RESTful using Simple JWT.

This lesson focuses on implementing the reset endpoint.

Create endpoints that facilitate password resets

In this lesson, we’ll create a few endpoints that work together to help the users reset their passwords. Let’s add the endpoints in main/urls.py, as shown below.

Python 3.8
# imports ..
urlpatterns = [
# other paths ..,
# new
path('request-password-reset-email/', views.RequestPasswordResetEmailView.as_view(), name='request-password-reset-email'),
path('password-reset/<uidb64>/<token>/', views.PasswordResetTokenValidationView.as_view(), name='password-reset-confirm'),
path('password-reset/', views.SetNewPasswordView.as_view(), name='password-reset'),
]

In the code above:

  • The request-password-reset-email/ endpoint in line 7 is for requesting a password reset link via email. It requires an email address from the
...