Look up emails case insensitive

This commit is contained in:
Tanner Collin 2020-06-26 03:12:56 +00:00
parent 942ecab890
commit bdbab31a17
2 changed files with 3 additions and 3 deletions

View File

@ -433,7 +433,7 @@ class MyPasswordChangeSerializer(PasswordChangeSerializer):
class MyPasswordResetSerializer(PasswordResetSerializer): class MyPasswordResetSerializer(PasswordResetSerializer):
def validate_email(self, email): def validate_email(self, email):
if not User.objects.filter(email=email).exists(): if not User.objects.filter(email__iexact=email).exists():
raise ValidationError('Not found.') raise ValidationError('Not found.')
return super().validate_email(email) return super().validate_email(email)

View File

@ -231,7 +231,7 @@ def link_old_member(data, user):
raise ValidationError(dict(email=msg)) raise ValidationError(dict(email=msg))
try: try:
member = models.Member.objects.get(old_email=data['email']) member = models.Member.objects.get(old_email__iexact=data['email'])
except models.Member.DoesNotExist: except models.Member.DoesNotExist:
msg = 'Unable to find email in old portal.' msg = 'Unable to find email in old portal.'
logger.info(msg) logger.info(msg)
@ -277,7 +277,7 @@ def link_old_member(data, user):
def create_new_member(data, user): def create_new_member(data, user):
if old_models: if old_models:
old_members = old_models.Members.objects.using('old_portal') old_members = old_models.Members.objects.using('old_portal')
if old_members.filter(email=data['email']).exists(): if old_members.filter(email__iexact=data['email']).exists():
msg = 'Account was found in old portal.' msg = 'Account was found in old portal.'
logger.info(msg) logger.info(msg)
raise ValidationError(dict(email=msg)) raise ValidationError(dict(email=msg))