Skip to content
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 a regression wherein users with historical usernames containing capital letters can't log in #168

Merged
merged 5 commits into from
Jul 29, 2022

Conversation

H-Shay
Copy link
Contributor

@H-Shay H-Shay commented Jul 26, 2022

Introduced in #163, which attempted to allow users to authenticate with LDAP usernames containing capital letters by lowercasing the username before interacting with Synapse. This then broke logins for users with historical usernames containing uppercase letters, as the login process created an access token based on the lowercased username, which didn't actually exist. This PR fixes this by only lowercasing the username if synapse is going to create a new account for the user, and using the value returned by check_user_exists as the canonical username.

@H-Shay H-Shay requested a review from a team as a code owner July 26, 2022 20:49
@H-Shay H-Shay marked this pull request as draft July 26, 2022 20:49
tests/test_simple.py Outdated Show resolved Hide resolved
@H-Shay H-Shay removed the request for review from a team July 26, 2022 20:55
Copy link
Contributor

@reivilibre reivilibre left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The non-test code / actual logic looks good to me, just test pedantry! (not that the tests were ever excellent in this project in the first place)

tests/test_ad.py Outdated Show resolved Hide resolved
tests/test_ad.py Outdated Show resolved Hide resolved
tests/test_ad.py Outdated Show resolved Hide resolved
tests/test_ad.py Outdated Show resolved Hide resolved
@H-Shay H-Shay requested a review from reivilibre July 27, 2022 17:58
@H-Shay
Copy link
Contributor Author

H-Shay commented Jul 27, 2022

btw the mypy failure is unrelated to this change and has been happening for awhile.

@H-Shay H-Shay marked this pull request as ready for review July 27, 2022 18:00
Copy link
Contributor

@reivilibre reivilibre left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks.

If you get a moment and think the mypy shenanigans are an easy fix, that may be worth doing separately.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants