This commit is contained in:
Matthew Hodgson 2018-03-13 01:50:32 +00:00
parent 0e2d70e101
commit 739d3500fe
3 changed files with 7 additions and 3 deletions

View File

@ -33,7 +33,9 @@ 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("check_is_for_allowed_local_3pids", False) self.check_is_for_allowed_local_3pids = config.get(
"check_is_for_allowed_local_3pids", False
)
self.registration_shared_secret = config.get("registration_shared_secret") self.registration_shared_secret = config.get("registration_shared_secret")
self.bcrypt_rounds = config.get("bcrypt_rounds", 12) self.bcrypt_rounds = config.get("bcrypt_rounds", 12)

View File

@ -308,7 +308,9 @@ class RegistrationHandler(BaseHandler):
logger.info("got threepid with medium '%s' and address '%s'", logger.info("got threepid with medium '%s' and address '%s'",
threepid['medium'], threepid['address']) threepid['medium'], threepid['address'])
if not (yield check_3pid_allowed(self.hs, threepid['medium'], threepid['address'])): if not (
yield check_3pid_allowed(self.hs, threepid['medium'], threepid['address'])
):
raise RegistrationError( raise RegistrationError(
403, "Third party identifier is not allowed" 403, "Third party identifier is not allowed"
) )

View File

@ -40,7 +40,7 @@ def check_3pid_allowed(hs, medium, address):
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/discover_urls"
), ),
{'medium': medium, 'address': address } {'medium': medium, 'address': address}
) )
defer.returnValue(data['hs_url'] + "/" == hs.config.public_baseurl) defer.returnValue(data['hs_url'] + "/" == hs.config.public_baseurl)
return return