This repository has been archived by the owner on Apr 26, 2024. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Don't offer password login when it is disabled #8835
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Fix minor long-standing bug in login, where we would offer the `password` login type if a custom auth provider supported it, even if password login was disabled. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -205,15 +205,23 @@ def __init__(self, hs: "HomeServer"): | |
# type in the list. (NB that the spec doesn't require us to do so and | ||
# clients which favour types that they don't understand over those that | ||
# they do are technically broken) | ||
|
||
# start out by assuming PASSWORD is enabled; we will remove it later if not. | ||
login_types = [] | ||
if self._password_enabled: | ||
if hs.config.password_localdb_enabled: | ||
login_types.append(LoginType.PASSWORD) | ||
|
||
for provider in self.password_providers: | ||
if hasattr(provider, "get_supported_login_types"): | ||
for t in provider.get_supported_login_types().keys(): | ||
if t not in login_types: | ||
login_types.append(t) | ||
|
||
if not self._password_enabled: | ||
login_types.remove(LoginType.PASSWORD) | ||
Comment on lines
+220
to
+221
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. So this says to support password logins if:
Is that correct? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. yes, basically - which matches the code used to actually check the auth submission later. |
||
|
||
self._supported_login_types = login_types | ||
|
||
# Login types and UI Auth types have a heavy overlap, but are not | ||
# necessarily identical. Login types have SSO (and other login types) | ||
# added in the rest layer, see synapse.rest.client.v1.login.LoginRestServerlet.on_GET. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Looks like
login_types
really wants to be aset
so we can just add things to it arbitrarily without having to check first.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.
yes, but see the comment just above.
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.
Right, I suppose there's other ways to solve that, but no need to restructure the whole thing.