From 43a5aaa9df99afae95432e2801e7c43463a67ea3 Mon Sep 17 00:00:00 2001 From: Jens Langhammer Date: Wed, 28 Sep 2022 18:52:54 +0200 Subject: [PATCH] stages/email: don't check that email templates exist on startup #3692 this runs on both server and worker where only the worker needs to have the email templates Signed-off-by: Jens Langhammer --- authentik/stages/email/apps.py | 23 ----------------------- 1 file changed, 23 deletions(-) diff --git a/authentik/stages/email/apps.py b/authentik/stages/email/apps.py index f69bbb728..13c9f7ff8 100644 --- a/authentik/stages/email/apps.py +++ b/authentik/stages/email/apps.py @@ -1,6 +1,4 @@ """authentik email stage config""" -from django.template.exceptions import TemplateDoesNotExist -from django.template.loader import get_template from structlog.stdlib import get_logger from authentik.blueprints.apps import ManagedAppConfig @@ -19,24 +17,3 @@ class AuthentikStageEmailConfig(ManagedAppConfig): def reconcile_load_stages_emails_tasks(self): """Load stages.emails tasks""" self.import_module("authentik.stages.email.tasks") - - def reconcile_stage_templates_valid(self): - """Ensure all stage's templates actually exist""" - from authentik.events.models import Event, EventAction - from authentik.stages.email.models import EmailStage, EmailTemplates - - for stage in EmailStage.objects.all(): - try: - get_template(stage.template) - except TemplateDoesNotExist: - LOGGER.warning("Stage template does not exist, resetting", path=stage.template) - Event.new( - EventAction.CONFIGURATION_ERROR, - stage=stage, - message=( - f"Template {stage.template} does not exist, resetting to default." - f" (Stage {stage.name})" - ), - ).save() - stage.template = EmailTemplates.ACCOUNT_CONFIRM - stage.save()