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( self.check_is_for_allowed_local_3pids = config.get(
"check_is_for_allowed_local_3pids", False "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.registration_shared_secret = config.get("registration_shared_secret")
self.bcrypt_rounds = config.get("bcrypt_rounds", 12) self.bcrypt_rounds = config.get("bcrypt_rounds", 12)
@ -70,6 +71,12 @@ class RegistrationConfig(Config):
# Overrides allowed_local_3pids below. # Overrides allowed_local_3pids below.
# check_is_for_allowed_local_3pids: matrix.org # 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: # allowed_local_3pids:
# - medium: email # - medium: email
# pattern: ".*@matrix\\.org" # pattern: ".*@matrix\\.org"

View File

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