Allow configuration for case-insensitive emails
See original GitHub issueThanks for writing Djoser! I really like the library and API.
The only thing I’ve found frustrating recently is that emails are automatically treated as case-sensitive per discussion in #87. What I’ve had to do is override all of the default serializers with the following method:
def validate_email(self, value):
return value.lower()
I suspect that a lot of sites using Djoser store emails as all-lowercase. Would you consider a PR that would apply something like the following code? This would incorporate a default value of CASE_SENSITIVE_EMAIL = True
but also allow me to easily change it globally for Djoser in terms of storing email, user login, password reset, etc. Happy to submit if it’s helpful. Let me know what you think!
def validate_email(self, value):
if settings.DJOSER['CASE_SENSITIVE_EMAIL'] is False:
return value.lower()
return value
Issue Analytics
- State:
- Created 4 years ago
- Reactions:1
- Comments:10 (5 by maintainers)
Top Results From Across the Web
Rails - Devise, Email Case Insensitivity - Stack Overflow
I just noticed that the login process is case sensitive for emails. so if you register with bob@apPle.com, and then try to log...
Read more >PostFix+Dovecot: Case Sensitive Email Address - Server Fault
I setup my server using this guide. It works great my only problem now is that the email address is case sensitive. I...
Read more >UsernameConfigurationType - Amazon Cognito
The username configuration type. ... Specifies whether user name case sensitivity will be applied for all users in the user pool through Amazon...
Read more >Are content filters and message filters case insensitive? - Cisco
Both content filters and message filters allow you to apply actions to the messages you specify. Typically, filter rules and actions use regular...
Read more >Does Azure AD B2C sign in policy support configuring case ...
Currently it seems that the email field is not case sensitive when ... does Azure AD B2C have configuration to enable/disable case sensitive...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Is this a feature that’s being considered? I would like to make username case insensitive, but I don’t currently see any means of doing so. What are my options?
@haxoza makes sense. As I think through it, I can’t think of a field other than email and username that would make sense for default sanitization. I also can’t think of a sanitization method other than case-insensitivity that makes sense to include in Djoser.
If you agree my suggestion would be to simply add two optional settings:
If you agree I’m happy to make the PR.