diff options
author | Andrew Morgan <andrew@amorgan.xyz> | 2020-09-29 17:14:44 +0100 |
---|---|---|
committer | Andrew Morgan <andrew@amorgan.xyz> | 2020-09-29 17:14:44 +0100 |
commit | 60784d81ef3bf6242f8f23db6314435f929ee1cc (patch) | |
tree | 3767f4b7a394311f3776b26ad725952b08e0baca | |
parent | Add argument specifying whether 3pid check is happening during registration (diff) | |
download | synapse-github/anoa/3pid_check_invite_exemption.tar.xz |
Make use of new argument to eliminate IS checks outside of registration github/anoa/3pid_check_invite_exemption anoa/3pid_check_invite_exemption
Diffstat (limited to '')
-rw-r--r-- | synapse/util/threepids.py | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/synapse/util/threepids.py b/synapse/util/threepids.py index 47327360f8..527d873935 100644 --- a/synapse/util/threepids.py +++ b/synapse/util/threepids.py @@ -33,7 +33,13 @@ async def check_3pid_allowed(hs, medium, address, during_registration: bool = Fa bool: whether the 3PID medium/address is allowed to be added to this HS """ - if hs.config.check_is_for_allowed_local_3pids: + if hs.config.check_is_for_allowed_local_3pids and during_registration: + # If this 3pid is being approved as part of registering a new user, + # we'll want to make sure the 3pid has been invited by someone already. + # + # We condition on registration so that user 3pids do not require an invite while + # doing tasks other than registration, such as resetting their password or adding a + # second email to their account. data = await hs.get_simple_http_client().get_json( "https://%s%s" % ( hs.config.check_is_for_allowed_local_3pids, |