do token generation only when allauth_settings.EMAIL_VERIFICATION is not set to 'MANDATORY'

This commit is contained in:
Mahmoud.Adel 2020-07-09 10:53:41 +02:00
parent 0b65b156e2
commit 7397ffd450

View File

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