Skip to content

Instantly share code, notes, and snippets.

@sankalpjonn
Created March 20, 2019 07:53
Show Gist options
  • Save sankalpjonn/48422adc8e58ff3ed41461407226c9f7 to your computer and use it in GitHub Desktop.
Save sankalpjonn/48422adc8e58ff3ed41461407226c9f7 to your computer and use it in GitHub Desktop.
client_user_email = validated_data['email']
try:
client_user = User.objects.get(username=client_user_email)
except User.DoesNotExist:
raise Exception("this email was not invited")
client_user.is_active=True
client_user.set_password(validated_data['password1'])
client_user.save()
token, _ = Token.objects.get_or_create(user=client_user)
return token.key
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment