Skip to content

Commit

Permalink
Fixes no-user issue
Browse files Browse the repository at this point in the history
  • Loading branch information
iMerica committed May 12, 2020
1 parent 1dd2019 commit 0be5b2d
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions dj_rest_auth/serializers.py
Expand Up @@ -208,16 +208,16 @@ def custom_validation(self, attrs):
def validate(self, attrs):
self._errors = {}

if not default_token_generator.check_token(self.user, attrs['token']):
raise ValidationError({'token': ['Invalid value']})

# Decode the uidb64 to uid to get User object
try:
uid = force_text(uid_decoder(attrs['uid']))
self.user = UserModel._default_manager.get(pk=uid)
except (TypeError, ValueError, OverflowError, UserModel.DoesNotExist):
raise ValidationError({'uid': ['Invalid value']})

if not default_token_generator.check_token(self.user, attrs['token']):
raise ValidationError({'token': ['Invalid value']})

self.custom_validation(attrs)
# Construct SetPasswordForm instance
self.set_password_form = self.set_password_form_class(
Expand Down

0 comments on commit 0be5b2d

Please sign in to comment.