diff --git a/authentik/events/models.py b/authentik/events/models.py
index 81e3a8b25..3ab92c2de 100644
--- a/authentik/events/models.py
+++ b/authentik/events/models.py
@@ -272,17 +272,24 @@ class NotificationTransport(models.Model):
def send_email(self, notification: "Notification") -> list[str]:
"""Send notification via global email configuration"""
- body_trunc = (
- (notification.body[:75] + "..")
- if len(notification.body) > 75
- else notification.body
- )
+ subject = "authentik Notification: "
+ key_value = {}
+ if notification.event:
+ subject += notification.event.action
+ for key, value in notification.event.context.items():
+ if not isinstance(value, str):
+ continue
+ key_value[key] = value
+ else:
+ subject += notification.body[:75]
mail = TemplateEmailMessage(
- subject=f"authentik Notification: {body_trunc}",
+ subject=subject,
template_name="email/generic.html",
to=[notification.user.email],
template_context={
+ "title": subject,
"body": notification.body,
+ "key_value": key_value,
},
)
# Email is sent directly here, as the call to send() should have been from a task.
diff --git a/authentik/stages/email/templates/email/generic.html b/authentik/stages/email/templates/email/generic.html
index 01a242111..2d853b390 100644
--- a/authentik/stages/email/templates/email/generic.html
+++ b/authentik/stages/email/templates/email/generic.html
@@ -1,5 +1,7 @@
{% extends "email/base.html" %}
+{% load i18n %}
+
{% block content %}
@@ -14,6 +16,29 @@
{{ body }}
|
+ {% if key_value %}
+
+
+
+
+ {% trans "Additional Information" %} |
+
+
+
+
+ {% for key, value in key_value.items %}
+
+ {{ key }} |
+ {{ value }} |
+
+ {% endfor %}
+
+ |
+
+
+ |
+
+ {% endif %}
diff --git a/web/src/pages/events/EventInfoPage.ts b/web/src/pages/events/EventInfoPage.ts
index a844c8807..aa11e9294 100644
--- a/web/src/pages/events/EventInfoPage.ts
+++ b/web/src/pages/events/EventInfoPage.ts
@@ -2,6 +2,7 @@ import { gettext } from "django";
import { css, CSSResult, customElement, html, LitElement, property, TemplateResult } from "lit-element";
import { Event } from "../../api/Events";
import { COMMON_STYLES } from "../../common/styles";
+import "./EventInfo";
@customElement("ak-event-info-page")
export class EventInfoPage extends LitElement {