Skip to content

Commit

Permalink
Update set_profile_displayname to use UserID type
Browse files Browse the repository at this point in the history
This is required as the function was updated to take this explicit type,
rather than just the localpart, in matrix-org/synapse#15458 as part of
version 1.83.

This is stacked atop ma1uta#10 to ensure everything is updated.
  • Loading branch information
joshuaboniface committed May 25, 2023
1 parent b6bdebb commit 1010ef4
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion rest_auth_provider.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
import time
import synapse
from synapse import module_api
from synapse.types import UserID

logger = logging.getLogger(__name__)

Expand Down Expand Up @@ -91,7 +92,9 @@ async def check_password(self, user_id, password):
logger.info("User not authenticated")
return False

types_user_id = UserID.from_string(user_id)
localpart = user_id.split(":", 1)[0][1:]
domain = user_id.split(":", 1)[1][1:]
logger.info("User %s authenticated", user_id)

registration = False
Expand All @@ -117,7 +120,7 @@ async def check_password(self, user_id, password):
if "display_name" in profile and ((registration and self.config.setNameOnRegister) or (self.config.setNameOnLogin)):
display_name = profile["display_name"]
logger.info("Setting display name to '%s' based on profile data", display_name)
await store.set_profile_displayname(localpart, display_name)
await store.set_profile_displayname(types_user_id, display_name)
else:
logger.info("Display name was not set because it was not given or policy restricted it")

Expand Down

0 comments on commit 1010ef4

Please sign in to comment.