summary refs log tree commit diff
path: root/synapse/handlers
diff options
context:
space:
mode:
authorAndrew Morgan <andrew@amorgan.xyz>2020-04-24 12:13:36 +0100
committerAndrew Morgan <andrew@amorgan.xyz>2020-04-24 12:13:36 +0100
commit1e94c2be0a3146ad8141f7f1f6e1a92618b17744 (patch)
tree03b5943a4c94043a757492a0de37349148a85de2 /synapse/handlers
parentRemove bind_email param from dinsic-specific code (diff)
downloadsynapse-1e94c2be0a3146ad8141f7f1f6e1a92618b17744.tar.xz
Remove protocol scheme from email delegate
This is an update to the commit ef8e78c1e623db5df97c7401bc5af9960946915e
Diffstat (limited to 'synapse/handlers')
-rw-r--r--synapse/handlers/register.py13
1 files changed, 12 insertions, 1 deletions
diff --git a/synapse/handlers/register.py b/synapse/handlers/register.py
index c0619838c3..a89cc0ffee 100644
--- a/synapse/handlers/register.py
+++ b/synapse/handlers/register.py
@@ -663,11 +663,22 @@ class RegistrationHandler(BaseHandler):
                     "Binding email to %s on id_server %s",
                     user_id, self.hs.config.account_threepid_delegate_email,
                 )
+
+                # Remove the protocol scheme before handling to `bind_threepid`
+                # `bind_threepid` will add https:// to it, so this restricts
+                # account_threepid_delegate.email to https:// addresses only
+                # We assume this is always the case for dinsic however.
+                if self.hs.config.account_threepid_delegate_email.startswith("https://"):
+                    id_server = self.hs.config.account_threepid_delegate_email[8:]
+                else:
+                    # Must start with http:// instead
+                    id_server = self.hs.config.account_threepid_delegate_email[7:]
+
                 yield self.identity_handler.bind_threepid(
                     bind_threepid_creds["client_secret"],
                     bind_threepid_creds["sid"],
                     user_id,
-                    self.hs.config.account_threepid_delegate_email,
+                    id_server,
                     bind_threepid_creds.get("id_access_token"),
                 )