Fix if condition in LoginSerializer

As there is no reference to 'rest_auth.registration' this condition always validates to False.
We should check if 'dj_rest_auth.registration' is in INSTALLED_APPS.
This commit is contained in:
Mathias Lantean 2020-03-11 15:23:22 -03:00
parent 229b75543e
commit e198f8dddb

View File

@ -100,7 +100,7 @@ class LoginSerializer(serializers.Serializer):
raise exceptions.ValidationError(msg) raise exceptions.ValidationError(msg)
# If required, is the email verified? # If required, is the email verified?
if 'rest_auth.registration' in settings.INSTALLED_APPS: if 'dj_rest_auth.registration' in settings.INSTALLED_APPS:
from allauth.account import app_settings from allauth.account import app_settings
if app_settings.EMAIL_VERIFICATION == app_settings.EmailVerificationMethod.MANDATORY: if app_settings.EMAIL_VERIFICATION == app_settings.EmailVerificationMethod.MANDATORY:
email_address = user.emailaddress_set.get(email=user.email) email_address = user.emailaddress_set.get(email=user.email)