-
-
Notifications
You must be signed in to change notification settings - Fork 60
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix case sensitivity issue in username handling #1146
base: master
Are you sure you want to change the base?
Fix case sensitivity issue in username handling #1146
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am only afraid what will be the implications of such change. Let us discuss in the next meeting.
Btw, would you mind adding the docs in settings file since you are on it?
@@ -394,7 +394,7 @@ def before_send(event, hint): | |||
# Choose one of "mandatory", "optional", or "none". | |||
# For local development and test use "optional" or "none" | |||
ACCOUNT_EMAIL_VERIFICATION = os.environ.get("ACCOUNT_EMAIL_VERIFICATION") | |||
ACCOUNT_PRESERVE_USERNAME_CASING = False | |||
ACCOUNT_PRESERVE_USERNAME_CASING = True |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ACCOUNT_PRESERVE_USERNAME_CASING = True | |
# This setting determines whether the username is stored in lowercase (False) or whether its casing is to be preserved (True). | |
# Note that when casing is preserved, potentially expensive __iexact lookups are performed when filter on username. | |
# For now, the default is set to True to maintain backwards compatibility. | |
# See https://docs.allauth.org/en/dev/account/configuration.html | |
ACCOUNT_PRESERVE_USERNAME_CASING = True | |
Could test locally, auth with uppercases in the login username seems to work fine !
Feeling the same. |
@tdrivas let us know what tests you have performed to ensure no regressions are there. |
Check updated description please! |
A few other manual tests on top of the ones you performed:
I believe we can write a new test function similar to
|
This PR resolves an issue where Django Allauth was treating all usernames as lowercase during authentication, preventing users with capital letters in their usernames from logging in.
The problem
Usernames were correctly stored in the database with their original case (e.g., Bob), but authentication failed if users entered their names with uppercase letters.
Solution
Updated
ACCOUNT_PRESERVE_USERNAME_CASING
toTrue
so to ensure usernames are not altered during authentication and are matched exactly as stored in the database.Impact
Test new functionality (Manual tests)