From 96e460df2ef80bc4fd23259fa7352efefcfcba44 Mon Sep 17 00:00:00 2001 From: Richard van der Hoff <1389908+richvdh@users.noreply.github.com> Date: Tue, 2 Feb 2021 18:35:28 +0000 Subject: [PATCH 1/6] social login: add noopener to terms link (#9300) --- changelog.d/9300.feature | 1 + synapse/res/templates/sso_new_user_consent.html | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) create mode 100644 changelog.d/9300.feature diff --git a/changelog.d/9300.feature b/changelog.d/9300.feature new file mode 100644 index 000000000..a2d0b27da --- /dev/null +++ b/changelog.d/9300.feature @@ -0,0 +1 @@ +Further improvements to the user experience of registration via single sign-on. diff --git a/synapse/res/templates/sso_new_user_consent.html b/synapse/res/templates/sso_new_user_consent.html index 8c33787c5..8f197007c 100644 --- a/synapse/res/templates/sso_new_user_consent.html +++ b/synapse/res/templates/sso_new_user_consent.html @@ -30,7 +30,7 @@
From f20dadb649891984437fa94d4b47d6c3f4a3acde Mon Sep 17 00:00:00 2001 From: Richard van der Hoff <1389908+richvdh@users.noreply.github.com> Date: Wed, 3 Feb 2021 16:13:09 +0000 Subject: [PATCH 2/6] Fix formatting for "bad session" error during sso registration flow (#9296) --- changelog.d/9296.bugfix | 1 + synapse/handlers/sso.py | 19 ++++++++++++++++--- 2 files changed, 17 insertions(+), 3 deletions(-) create mode 100644 changelog.d/9296.bugfix diff --git a/changelog.d/9296.bugfix b/changelog.d/9296.bugfix new file mode 100644 index 000000000..d723f8c5b --- /dev/null +++ b/changelog.d/9296.bugfix @@ -0,0 +1 @@ +Fix bug in Synapse 1.27.0rc1 which meant the "session expired" error page during SSO registration was badly formatted. diff --git a/synapse/handlers/sso.py b/synapse/handlers/sso.py index b450668f1..96ccd991e 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", From 7a0dcea3e5a9a9f1dae30947b62d0a183e6d0668 Mon Sep 17 00:00:00 2001 From: Richard van der Hoff <1389908+richvdh@users.noreply.github.com> Date: Wed, 3 Feb 2021 17:52:55 +0000 Subject: [PATCH 3/6] social login Fix username validation javascript (#9297) * fix validation and don't use built-in validation UI Co-authored-by: Bruno Windels