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):
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.')
return super().validate_email(email)

View File

@ -231,7 +231,7 @@ def link_old_member(data, user):
raise ValidationError(dict(email=msg))
try:
member = models.Member.objects.get(old_email=data['email'])
member = models.Member.objects.get(old_email__iexact=data['email'])
except models.Member.DoesNotExist:
msg = 'Unable to find email in old portal.'
logger.info(msg)
@ -277,7 +277,7 @@ def link_old_member(data, user):
def create_new_member(data, user):
if old_models:
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.'
logger.info(msg)
raise ValidationError(dict(email=msg))