summary refs log tree commit diff
diff options
context:
space:
mode:
authorMatthew Hodgson <matthew@matrix.org>2018-03-14 22:09:08 +0000
committerMatthew Hodgson <matthew@matrix.org>2018-03-14 22:09:08 +0000
commit2e4a6c5aaba238760c4ad4e97ca132ccbbb2cc7b (patch)
treedf2b4d6be99639212a8c85dc94c6ed15cee05708
parentMerge branch 'develop' into matthew/dinsic_3pid_check (diff)
downloadsynapse-2e4a6c5aaba238760c4ad4e97ca132ccbbb2cc7b.tar.xz
incorporate PR feedback and rename URL
-rw-r--r--synapse/config/registration.py3
-rw-r--r--synapse/util/threepids.py8
2 files changed, 3 insertions, 8 deletions
diff --git a/synapse/config/registration.py b/synapse/config/registration.py
index dc3c85a517..2854a48d0a 100644
--- a/synapse/config/registration.py
+++ b/synapse/config/registration.py
@@ -34,7 +34,7 @@ class RegistrationConfig(Config):
         self.registrations_require_3pid = config.get("registrations_require_3pid", [])
         self.allowed_local_3pids = config.get("allowed_local_3pids", [])
         self.check_is_for_allowed_local_3pids = config.get(
-            "check_is_for_allowed_local_3pids", False
+            "check_is_for_allowed_local_3pids", None
         )
         self.allow_invited_3pids = config.get("allow_invited_3pids", False)
         self.registration_shared_secret = config.get("registration_shared_secret")
@@ -85,7 +85,6 @@ class RegistrationConfig(Config):
         #     - medium: msisdn
         #       pattern: "\\+44"
 
-
         # If set, allows registration by anyone who also has the shared
         # secret, even if registration is otherwise disabled.
         registration_shared_secret: "%(registration_shared_secret)s"
diff --git a/synapse/util/threepids.py b/synapse/util/threepids.py
index 94c0852f0c..353d220bad 100644
--- a/synapse/util/threepids.py
+++ b/synapse/util/threepids.py
@@ -38,15 +38,14 @@ def check_3pid_allowed(hs, medium, address):
         data = yield hs.get_simple_http_client().get_json(
             "https://%s%s" % (
                 hs.config.check_is_for_allowed_local_3pids,
-                "/_matrix/identity/api/v1/discover_urls"
+                "/_matrix/identity/api/v1/info"
             ),
             {'medium': medium, 'address': address}
         )
         if hs.config.allow_invited_3pids and data.get('invited'):
             defer.returnValue(True)
         else:
-            defer.returnValue(data['hs_url'] + "/" == hs.config.public_baseurl)
-        return
+            defer.returnValue(data['hs'] == hs.config.server_name)
 
     if hs.config.allowed_local_3pids:
         for constraint in hs.config.allowed_local_3pids:
@@ -59,10 +58,7 @@ def check_3pid_allowed(hs, medium, address):
                 re.match(constraint['pattern'], address)
             ):
                 defer.returnValue(True)
-                return
     else:
         defer.returnValue(True)
-        return
 
     defer.returnValue(False)
-    return