From 7783b200a3d1384aa8a2958e2009b7ba63135c72 Mon Sep 17 00:00:00 2001 From: Jens L Date: Mon, 18 Mar 2024 11:53:08 +0100 Subject: [PATCH] events: discard notification if user has empty email (#8938) Signed-off-by: Jens Langhammer --- authentik/events/models.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/authentik/events/models.py b/authentik/events/models.py index 1a01ea7377..c76931f93d 100644 --- a/authentik/events/models.py +++ b/authentik/events/models.py @@ -452,6 +452,13 @@ class NotificationTransport(SerializerModel): def send_email(self, notification: "Notification") -> list[str]: """Send notification via global email configuration""" + if notification.user.email.strip() == "": + LOGGER.info( + "Discarding notification as user has no email address", + user=notification.user, + notification=notification, + ) + return None subject_prefix = "authentik Notification: " context = { "key_value": {