summary refs log tree commit diff
path: root/synapse/handlers
diff options
context:
space:
mode:
authorRichard van der Hoff <1389908+richvdh@users.noreply.github.com>2021-02-03 16:13:09 +0000
committerGitHub <noreply@github.com>2021-02-03 16:13:09 +0000
commitf20dadb649891984437fa94d4b47d6c3f4a3acde (patch)
tree10fd513596c6f3180b483cafadc9fcf2ad161ae3 /synapse/handlers
parentsocial login: add noopener to terms link (#9300) (diff)
downloadsynapse-f20dadb649891984437fa94d4b47d6c3f4a3acde.tar.xz
Fix formatting for "bad session" error during sso registration flow (#9296)
Diffstat (limited to 'synapse/handlers')
-rw-r--r--synapse/handlers/sso.py19
1 files changed, 16 insertions, 3 deletions
diff --git a/synapse/handlers/sso.py b/synapse/handlers/sso.py
index b450668f1c..96ccd991ed 100644
--- a/synapse/handlers/sso.py
+++ b/synapse/handlers/sso.py
@@ -742,7 +742,11 @@ class SsoHandler:
             use_display_name: whether the user wants to use the suggested display name
             emails_to_use: emails that the user would like to use
         """
-        session = self.get_mapping_session(session_id)
+        try:
+            session = self.get_mapping_session(session_id)
+        except SynapseError as e:
+            self.render_error(request, "bad_session", e.msg, code=e.code)
+            return
 
         # update the session with the user's choices
         session.chosen_localpart = localpart
@@ -793,7 +797,12 @@ class SsoHandler:
             session_id,
             terms_version,
         )
-        session = self.get_mapping_session(session_id)
+        try:
+            session = self.get_mapping_session(session_id)
+        except SynapseError as e:
+            self.render_error(request, "bad_session", e.msg, code=e.code)
+            return
+
         session.terms_accepted_version = terms_version
 
         # we're done; now we can register the user
@@ -808,7 +817,11 @@ class SsoHandler:
             request: HTTP request
             session_id: ID of the username mapping session, extracted from a cookie
         """
-        session = self.get_mapping_session(session_id)
+        try:
+            session = self.get_mapping_session(session_id)
+        except SynapseError as e:
+            self.render_error(request, "bad_session", e.msg, code=e.code)
+            return
 
         logger.info(
             "[session %s] Registering localpart %s",