diff --git a/synapse/config/registration.py b/synapse/config/registration.py index 6cd830a78..dc3c85a51 100644 --- a/synapse/config/registration.py +++ b/synapse/config/registration.py @@ -36,6 +36,7 @@ class RegistrationConfig(Config): self.check_is_for_allowed_local_3pids = config.get( "check_is_for_allowed_local_3pids", False ) + self.allow_invited_3pids = config.get("allow_invited_3pids", False) self.registration_shared_secret = config.get("registration_shared_secret") self.bcrypt_rounds = config.get("bcrypt_rounds", 12) @@ -70,6 +71,12 @@ class RegistrationConfig(Config): # Overrides allowed_local_3pids below. # check_is_for_allowed_local_3pids: matrix.org # + # If you are using an IS you can also check whether that IS registers + # pending invites for the given 3PID (and then allow it to sign up on + # the platform): + # + # allow_invited_3pids: False + # # allowed_local_3pids: # - medium: email # pattern: ".*@matrix\\.org" diff --git a/synapse/util/threepids.py b/synapse/util/threepids.py index e1cf5dbb1..94c0852f0 100644 --- a/synapse/util/threepids.py +++ b/synapse/util/threepids.py @@ -42,7 +42,10 @@ def check_3pid_allowed(hs, medium, address): ), {'medium': medium, 'address': address} ) - defer.returnValue(data['hs_url'] + "/" == hs.config.public_baseurl) + if hs.config.allow_invited_3pids and data.get('invited'): + defer.returnValue(True) + else: + defer.returnValue(data['hs_url'] + "/" == hs.config.public_baseurl) return if hs.config.allowed_local_3pids: