summary refs log tree commit diff
path: root/synapse
diff options
context:
space:
mode:
authorErik Johnston <erik@matrix.org>2021-02-25 15:35:14 +0000
committerGitHub <noreply@github.com>2021-02-25 15:35:14 +0000
commit2566dc57ce69b1a141014cc7231f84ea6d3f3ea7 (patch)
tree98b69f702276b10452e11f9a5a501b63d24b00a1 /synapse
parentEnsure pushers are deleted for deactivated accounts (#9285) (diff)
downloadsynapse-2566dc57ce69b1a141014cc7231f84ea6d3f3ea7.tar.xz
Test that we require validated email for email pushers (#9496)
Diffstat (limited to 'synapse')
-rw-r--r--synapse/push/pusherpool.py6
1 files changed, 6 insertions, 0 deletions
diff --git a/synapse/push/pusherpool.py b/synapse/push/pusherpool.py

index 21f14f05f0..4c7f5fecee 100644 --- a/synapse/push/pusherpool.py +++ b/synapse/push/pusherpool.py
@@ -19,6 +19,7 @@ from typing import TYPE_CHECKING, Dict, Iterable, Optional from prometheus_client import Gauge +from synapse.api.errors import Codes, SynapseError from synapse.metrics.background_process_metrics import ( run_as_background_process, wrap_as_background_process, @@ -113,6 +114,11 @@ class PusherPool: The newly created pusher. """ + if kind == "email": + email_owner = await self.store.get_user_id_by_threepid("email", pushkey) + if email_owner != user_id: + raise SynapseError(400, "Email not found", Codes.THREEPID_NOT_FOUND) + time_now_msec = self.clock.time_msec() # create the pusher setting last_stream_ordering to the current maximum