feat(email): generic webhook for all notification emails, hide SMTP UI
Aegis CI / lint-and-test (push) Has been cancelled
Snyk Security Scan / Python vulnerabilities (backend) (push) Has been cancelled
Snyk Security Scan / npm vulnerabilities (frontend) (push) Has been cancelled
Snyk Security Scan / Docker image vulnerabilities (backend) (push) Has been cancelled

- Renamed the password-setup webhook (email_webhook.*, /system/email-webhook-config)
  and made it the single transport for all notification emails.
- New webhook_email_service.py shared by password_setup_service and
  notification_service.
- Wired test validated/rejected, campaign completed, and new-MITRE-technique
  notifications through the webhook (previously dead SMTP code, never triggered).
- Added POST /system/email-webhook-test to send a real test email.
- Hid the Email/SMTP settings tab from the UI (SMTP code kept intact, unused).
- Redact email_webhook.api_key on config export.
This commit is contained in:
kitos
2026-07-20 10:24:15 +02:00
parent bbe7f49c86
commit 1d0d880929
11 changed files with 442 additions and 146 deletions
@@ -755,6 +755,15 @@ def complete_campaign(db: Session, campaign_id: str) -> Campaign:
campaign.completed_at = datetime.utcnow()
# Flush changes to DB without committing the transaction
db.flush()
from app.services.notification_service import notify_user_by_email
notify_user_by_email(
db, campaign.created_by,
preference_key="email_on_campaign_completed",
subject=f"Campaign Completed: {campaign.name}",
message=f'Your campaign "{campaign.name}" has been completed.',
)
# Return campaign
return campaign