diff options
author | Andrew Morgan <andrew@amorgan.xyz> | 2019-02-27 15:22:41 +0000 |
---|---|---|
committer | Andrew Morgan <andrew@amorgan.xyz> | 2019-02-27 15:22:41 +0000 |
commit | 9b13038d05b0a3ebba86e6884999bcc534c3f0e2 (patch) | |
tree | bffd249b8cbe1ce40f7fc69c3fd3d9b8e9d4a66d /synapse/util | |
parent | Use internal-info for identity server. Block reg on fields (diff) | |
download | synapse-9b13038d05b0a3ebba86e6884999bcc534c3f0e2.tar.xz |
Check shadow_hs as well as hs during 3pid reg
Diffstat (limited to 'synapse/util')
-rw-r--r-- | synapse/util/threepids.py | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/synapse/util/threepids.py b/synapse/util/threepids.py index 4f3cb9c804..1db0a01e27 100644 --- a/synapse/util/threepids.py +++ b/synapse/util/threepids.py @@ -43,17 +43,19 @@ def check_3pid_allowed(hs, medium, address): {'medium': medium, 'address': address} ) - # Assume false if invalid response - if 'hs' not in data: + # Check for invalid response + if 'hs' not in data and 'shadow_hs' not in data: + defer.returnValue(False) + + # Check if this user is intended to register for this homeserver + if data['hs'] != hs.config.server_name and data['shadow_hs'] != hs.config.server_name: defer.returnValue(False) if data.get('requires_invite', False) and data.get('invited', False) == False: # Requires an invite but hasn't been invited defer.returnValue(False) - if hs.config.allow_invited_3pids and data.get('invited'): - defer.returnValue(True) - else: - defer.returnValue(data['hs'] == hs.config.server_name) + + defer.returnValue(True) if hs.config.allowed_local_3pids: for constraint in hs.config.allowed_local_3pids: |