Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions django_rest_passwordreset/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,10 @@ def post(self, request, *args, **kwargs):

# find token
reset_password_token = ResetPasswordToken.objects.filter(key=token).first()
if not reset_password_token:
# Check if token exists and raise a validation error for the serializer
# with a correct feedback
raise exceptions.ValidationError({'token': 'Invalid token'})

# change users password (if we got to this code it means that the user is_active)
if reset_password_token.user.eligible_for_reset():
Expand Down