Merge pull request #111 from mohmyo/master

Do token generation only when EMAIL_VERIFICATION is not set to 'MANDATORY'
This commit is contained in:
Michael 2020-07-09 23:15:56 -05:00 committed by GitHub
commit 1ffcbfe6a8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -69,10 +69,12 @@ class RegisterView(CreateAPIView):
def perform_create(self, serializer): def perform_create(self, serializer):
user = serializer.save(self.request) user = serializer.save(self.request)
if getattr(settings, 'REST_USE_JWT', False): if allauth_settings.EMAIL_VERIFICATION != \
self.access_token, self.refresh_token = jwt_encode(user) allauth_settings.EmailVerificationMethod.MANDATORY:
else: if getattr(settings, 'REST_USE_JWT', False):
create_token(self.token_model, user, serializer) self.access_token, self.refresh_token = jwt_encode(user)
else:
create_token(self.token_model, user, serializer)
complete_signup(self.request._request, user, complete_signup(self.request._request, user,
allauth_settings.EMAIL_VERIFICATION, allauth_settings.EMAIL_VERIFICATION,