From 60784d81ef3bf6242f8f23db6314435f929ee1cc Mon Sep 17 00:00:00 2001 From: Andrew Morgan Date: Tue, 29 Sep 2020 17:14:44 +0100 Subject: Make use of new argument to eliminate IS checks outside of registration --- synapse/util/threepids.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) 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, -- cgit 1.4.1