I use email address as a username in my Django application
USERNAME_FIELD = 'email'
but email field is case-sensitive so:
[email protected]
and [email protected]
are saved as two different users. It's normal or should I validate this somehow?
Lowercase the email before using it for operations like saving, comparing etc.
def save(self, *args, **kwargs):
self.email = self.email.lower()
return super(User, self).save(*args, **kwargs)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With