incorporate PR feedback and rename URL

This commit is contained in:
Matthew Hodgson 2018-03-14 22:09:08 +00:00
parent e3eb2cfe8b
commit 2e4a6c5aab
2 changed files with 3 additions and 8 deletions

View File

@ -34,7 +34,7 @@ class RegistrationConfig(Config):
self.registrations_require_3pid = config.get("registrations_require_3pid", []) self.registrations_require_3pid = config.get("registrations_require_3pid", [])
self.allowed_local_3pids = config.get("allowed_local_3pids", []) self.allowed_local_3pids = config.get("allowed_local_3pids", [])
self.check_is_for_allowed_local_3pids = config.get( 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.allow_invited_3pids = config.get("allow_invited_3pids", False)
self.registration_shared_secret = config.get("registration_shared_secret") self.registration_shared_secret = config.get("registration_shared_secret")
@ -85,7 +85,6 @@ class RegistrationConfig(Config):
# - medium: msisdn # - medium: msisdn
# pattern: "\\+44" # pattern: "\\+44"
# If set, allows registration by anyone who also has the shared # If set, allows registration by anyone who also has the shared
# secret, even if registration is otherwise disabled. # secret, even if registration is otherwise disabled.
registration_shared_secret: "%(registration_shared_secret)s" registration_shared_secret: "%(registration_shared_secret)s"

View File

@ -38,15 +38,14 @@ def check_3pid_allowed(hs, medium, address):
data = yield hs.get_simple_http_client().get_json( data = yield hs.get_simple_http_client().get_json(
"https://%s%s" % ( "https://%s%s" % (
hs.config.check_is_for_allowed_local_3pids, hs.config.check_is_for_allowed_local_3pids,
"/_matrix/identity/api/v1/discover_urls" "/_matrix/identity/api/v1/info"
), ),
{'medium': medium, 'address': address} {'medium': medium, 'address': address}
) )
if hs.config.allow_invited_3pids and data.get('invited'): if hs.config.allow_invited_3pids and data.get('invited'):
defer.returnValue(True) defer.returnValue(True)
else: else:
defer.returnValue(data['hs_url'] + "/" == hs.config.public_baseurl) defer.returnValue(data['hs'] == hs.config.server_name)
return
if hs.config.allowed_local_3pids: if hs.config.allowed_local_3pids:
for constraint in 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) re.match(constraint['pattern'], address)
): ):
defer.returnValue(True) defer.returnValue(True)
return
else: else:
defer.returnValue(True) defer.returnValue(True)
return
defer.returnValue(False) defer.returnValue(False)
return