summary refs log tree commit diff
path: root/synapse/rest
diff options
context:
space:
mode:
authorBrendan Abolivier <babolivier@matrix.org>2022-03-11 14:20:00 +0100
committerGitHub <noreply@github.com>2022-03-11 13:20:00 +0000
commit003cc6910af177fec86ae7f43683d146975c7f4b (patch)
tree4e88aadc57585ea4e50b7067fed76975f1373714 /synapse/rest
parentAdd type hints to `tests/rest`. (#12208) (diff)
downloadsynapse-003cc6910af177fec86ae7f43683d146975c7f4b.tar.xz
Update the SSO username picker template to comply with SIWA guidelines (#12210)
Fixes https://github.com/matrix-org/synapse/issues/12205
Diffstat (limited to 'synapse/rest')
-rw-r--r--synapse/rest/synapse/client/pick_username.py8
1 files changed, 8 insertions, 0 deletions
diff --git a/synapse/rest/synapse/client/pick_username.py b/synapse/rest/synapse/client/pick_username.py
index 28ae083497..6338fbaaa9 100644
--- a/synapse/rest/synapse/client/pick_username.py
+++ b/synapse/rest/synapse/client/pick_username.py
@@ -92,12 +92,20 @@ class AccountDetailsResource(DirectServeHtmlResource):
             self._sso_handler.render_error(request, "bad_session", e.msg, code=e.code)
             return
 
+        # The configuration might mandate going through this step to validate an
+        # automatically generated localpart, so session.chosen_localpart might already
+        # be set.
+        localpart = ""
+        if session.chosen_localpart is not None:
+            localpart = session.chosen_localpart
+
         idp_id = session.auth_provider_id
         template_params = {
             "idp": self._sso_handler.get_identity_providers()[idp_id],
             "user_attributes": {
                 "display_name": session.display_name,
                 "emails": session.emails,
+                "localpart": localpart,
             },
         }