Initial commit: AegisSight-Monitor (OSINT-Monitoringsystem)
Dieser Commit ist enthalten in:
138
src/email_utils/templates.py
Normale Datei
138
src/email_utils/templates.py
Normale Datei
@@ -0,0 +1,138 @@
|
||||
"""HTML-E-Mail-Vorlagen fuer Magic Links, Einladungen und Benachrichtigungen."""
|
||||
|
||||
|
||||
def magic_link_login_email(username: str, code: str, link: str) -> tuple[str, str]:
|
||||
"""Erzeugt Login-E-Mail mit Magic Link und Code.
|
||||
|
||||
Returns:
|
||||
(subject, html_body)
|
||||
"""
|
||||
subject = f"AegisSight Monitor - Anmeldung"
|
||||
html = f"""<!DOCTYPE html>
|
||||
<html>
|
||||
<head><meta charset="UTF-8"></head>
|
||||
<body style="font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; background: #0f172a; color: #e2e8f0; padding: 40px 20px;">
|
||||
<div style="max-width: 480px; margin: 0 auto; background: #1e293b; border-radius: 12px; padding: 32px; border: 1px solid #334155;">
|
||||
<h1 style="color: #f0b429; font-size: 20px; margin: 0 0 24px 0;">AegisSight Monitor</h1>
|
||||
|
||||
<p style="margin: 0 0 16px 0;">Hallo {username},</p>
|
||||
|
||||
<p style="margin: 0 0 24px 0;">Klicken Sie auf den Link oder geben Sie den Code ein, um sich anzumelden:</p>
|
||||
|
||||
<div style="background: #0f172a; border-radius: 8px; padding: 20px; text-align: center; margin: 0 0 24px 0;">
|
||||
<div style="font-size: 32px; font-weight: 700; letter-spacing: 8px; color: #f0b429; font-family: monospace;">{code}</div>
|
||||
</div>
|
||||
|
||||
<div style="text-align: center; margin: 0 0 24px 0;">
|
||||
<a href="{link}" style="display: inline-block; background: #f0b429; color: #0f172a; padding: 12px 32px; border-radius: 6px; text-decoration: none; font-weight: 600;">Jetzt anmelden</a>
|
||||
</div>
|
||||
|
||||
<p style="color: #94a3b8; font-size: 13px; margin: 0;">Dieser Link ist 10 Minuten gueltig. Falls Sie diese Anmeldung nicht angefordert haben, ignorieren Sie diese E-Mail.</p>
|
||||
</div>
|
||||
</body>
|
||||
</html>"""
|
||||
return subject, html
|
||||
|
||||
|
||||
def invite_email(username: str, org_name: str, code: str, link: str) -> tuple[str, str]:
|
||||
"""Erzeugt Einladungs-E-Mail fuer neue Nutzer.
|
||||
|
||||
Returns:
|
||||
(subject, html_body)
|
||||
"""
|
||||
subject = f"Einladung zum AegisSight Monitor - {org_name}"
|
||||
html = f"""<!DOCTYPE html>
|
||||
<html>
|
||||
<head><meta charset="UTF-8"></head>
|
||||
<body style="font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; background: #0f172a; color: #e2e8f0; padding: 40px 20px;">
|
||||
<div style="max-width: 480px; margin: 0 auto; background: #1e293b; border-radius: 12px; padding: 32px; border: 1px solid #334155;">
|
||||
<h1 style="color: #f0b429; font-size: 20px; margin: 0 0 24px 0;">AegisSight Monitor</h1>
|
||||
|
||||
<p style="margin: 0 0 16px 0;">Hallo {username},</p>
|
||||
|
||||
<p style="margin: 0 0 16px 0;">Sie wurden zur Organisation <strong>{org_name}</strong> im AegisSight Monitor eingeladen.</p>
|
||||
|
||||
<p style="margin: 0 0 24px 0;">Klicken Sie auf den Link, um Ihren Zugang zu aktivieren:</p>
|
||||
|
||||
<div style="background: #0f172a; border-radius: 8px; padding: 20px; text-align: center; margin: 0 0 24px 0;">
|
||||
<div style="font-size: 32px; font-weight: 700; letter-spacing: 8px; color: #f0b429; font-family: monospace;">{code}</div>
|
||||
</div>
|
||||
|
||||
<div style="text-align: center; margin: 0 0 24px 0;">
|
||||
<a href="{link}" style="display: inline-block; background: #f0b429; color: #0f172a; padding: 12px 32px; border-radius: 6px; text-decoration: none; font-weight: 600;">Einladung annehmen</a>
|
||||
</div>
|
||||
|
||||
<p style="color: #94a3b8; font-size: 13px; margin: 0;">Dieser Link ist 48 Stunden gueltig.</p>
|
||||
</div>
|
||||
</body>
|
||||
</html>"""
|
||||
return subject, html
|
||||
|
||||
|
||||
def incident_notification_email(
|
||||
username: str,
|
||||
incident_title: str,
|
||||
notifications: list[dict],
|
||||
dashboard_url: str,
|
||||
) -> tuple[str, str]:
|
||||
"""Erzeugt Benachrichtigungs-E-Mail fuer Lagen-Updates.
|
||||
|
||||
Args:
|
||||
username: Empfaenger-Name
|
||||
incident_title: Titel der Lage/Recherche
|
||||
notifications: Liste von {"text": ..., "icon": ...} Dicts
|
||||
dashboard_url: Link zum Dashboard
|
||||
|
||||
Returns:
|
||||
(subject, html_body)
|
||||
"""
|
||||
subject = f"AegisSight - {incident_title}"
|
||||
|
||||
icon_map = {
|
||||
"success": "✓", # Haekchen
|
||||
"warning": "⚠", # Warndreieck
|
||||
"error": "✗", # Kreuz
|
||||
"info": "ⓘ", # Info-Kreis
|
||||
}
|
||||
color_map = {
|
||||
"success": "#22c55e",
|
||||
"warning": "#f0b429",
|
||||
"error": "#ef4444",
|
||||
"info": "#94a3b8",
|
||||
}
|
||||
|
||||
items_html = ""
|
||||
for n in notifications:
|
||||
icon = icon_map.get(n.get("icon", "info"), "ⓘ")
|
||||
color = color_map.get(n.get("icon", "info"), "#94a3b8")
|
||||
text = n.get("text", "")
|
||||
items_html += f"""
|
||||
<div style="display: flex; align-items: flex-start; gap: 10px; padding: 10px 0; border-bottom: 1px solid #334155;">
|
||||
<span style="color: {color}; font-size: 18px; line-height: 1;">{icon}</span>
|
||||
<span style="color: #e2e8f0; font-size: 14px; line-height: 1.4;">{text}</span>
|
||||
</div>"""
|
||||
|
||||
html = f"""<!DOCTYPE html>
|
||||
<html>
|
||||
<head><meta charset="UTF-8"></head>
|
||||
<body style="font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; background: #0f172a; color: #e2e8f0; padding: 40px 20px;">
|
||||
<div style="max-width: 480px; margin: 0 auto; background: #1e293b; border-radius: 12px; padding: 32px; border: 1px solid #334155;">
|
||||
<h1 style="color: #f0b429; font-size: 20px; margin: 0 0 8px 0;">AegisSight Monitor</h1>
|
||||
<p style="color: #94a3b8; font-size: 12px; margin: 0 0 24px 0;">Lagebericht-Benachrichtigung</p>
|
||||
|
||||
<p style="margin: 0 0 8px 0;">Hallo {username},</p>
|
||||
<p style="margin: 0 0 20px 0;">es gibt Neuigkeiten zur Lage <strong style="color: #f0b429;">{incident_title}</strong>:</p>
|
||||
|
||||
<div style="background: #0f172a; border-radius: 8px; padding: 4px 16px; margin: 0 0 24px 0;">
|
||||
{items_html}
|
||||
</div>
|
||||
|
||||
<div style="text-align: center; margin: 0 0 24px 0;">
|
||||
<a href="{dashboard_url}" style="display: inline-block; background: #f0b429; color: #0f172a; padding: 12px 32px; border-radius: 6px; text-decoration: none; font-weight: 600;">Im Dashboard ansehen</a>
|
||||
</div>
|
||||
|
||||
<p style="color: #64748b; font-size: 12px; margin: 0;">Diese Benachrichtigung kann in den Einstellungen im Dashboard deaktiviert werden.</p>
|
||||
</div>
|
||||
</body>
|
||||
</html>"""
|
||||
return subject, html
|
||||
In neuem Issue referenzieren
Einen Benutzer sperren