add 'allow_invited_3pids' option to invited 3PIDs to register

This commit is contained in:
Matthew Hodgson 2018-03-13 21:15:14 +00:00
parent 739d3500fe
commit 5c341c99f6
2 changed files with 11 additions and 1 deletions

View file

@ -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"

View file

@ -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: