question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Allow configuration for case-insensitive emails

See original GitHub issue

Thanks 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:open
  • Created 4 years ago
  • Reactions:1
  • Comments:10 (5 by maintainers)

github_iconTop GitHub Comments

4reactions
FendyPierrecommented, Dec 29, 2019

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?

2reactions
YPCrumblecommented, Dec 10, 2019

@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:

DJOSER_CASE_SENSITIVE_EMAIL = True
DJOSER_CASE_SENSITIVE_USERNAME = True

If you agree I’m happy to make the PR.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found