diff --git a/authentik/api/templates/api/browser.html b/authentik/api/templates/api/browser.html index 2ea149f72..0f29ea4be 100644 --- a/authentik/api/templates/api/browser.html +++ b/authentik/api/templates/api/browser.html @@ -3,7 +3,7 @@ {% load static %} {% block title %} -API Browser - {{ config.authentik.branding.title }} +API Browser - {{ tenant.branding_title }} {% endblock %} {% block head %} diff --git a/authentik/core/templates/login/base_full.html b/authentik/core/templates/login/base_full.html index 347036a92..72405f7f7 100644 --- a/authentik/core/templates/login/base_full.html +++ b/authentik/core/templates/login/base_full.html @@ -26,10 +26,7 @@
- authentik icon - {% if config.authentik.branding.title_show %} -

{{ config.authentik.branding.title }}

- {% endif %} + authentik icon
{% block main_container %} diff --git a/authentik/lib/config.py b/authentik/lib/config.py index 41f51595e..e3b00a7e1 100644 --- a/authentik/lib/config.py +++ b/authentik/lib/config.py @@ -10,9 +10,6 @@ from urllib.parse import urlparse import yaml from django.conf import ImproperlyConfigured -from django.http import HttpRequest - -from authentik import __version__ SEARCH_PATHS = ["authentik/lib/default.yml", "/etc/authentik/config.yml", ""] + glob( "/etc/authentik/config.d/*.yml", recursive=True @@ -21,11 +18,6 @@ ENV_PREFIX = "AUTHENTIK" ENVIRONMENT = os.getenv(f"{ENV_PREFIX}_ENV", "local") -def context_processor(request: HttpRequest) -> dict[str, Any]: - """Context Processor that injects config object into every template""" - return {"config": CONFIG.raw, "ak_version": __version__} - - class ConfigLoader: """Search through SEARCH_PATHS and load configuration. Environment variables starting with `ENV_PREFIX` are also applied. diff --git a/authentik/policies/templates/policies/denied.html b/authentik/policies/templates/policies/denied.html index 6ee0389fc..65565e7de 100644 --- a/authentik/policies/templates/policies/denied.html +++ b/authentik/policies/templates/policies/denied.html @@ -4,7 +4,7 @@ {% load i18n %} {% block title %} -{% trans 'Permission denied' %} - {{ config.authentik.branding.title }} +{% trans 'Permission denied' %} - {{ tenant.branding_title }} {% endblock %} {% block card_title %} diff --git a/authentik/providers/oauth2/templates/providers/oauth2/end_session.html b/authentik/providers/oauth2/templates/providers/oauth2/end_session.html index b6c88cc12..5dbc26898 100644 --- a/authentik/providers/oauth2/templates/providers/oauth2/end_session.html +++ b/authentik/providers/oauth2/templates/providers/oauth2/end_session.html @@ -14,7 +14,7 @@ {% endblock %} {% block title %} -{% trans 'End session' %} - {{ config.authentik.branding.title }} +{% trans 'End session' %} - {{ tenant.branding_title }} {% endblock %} {% block card_title %} diff --git a/authentik/root/settings.py b/authentik/root/settings.py index 5ceb0554f..99d0b0f6f 100644 --- a/authentik/root/settings.py +++ b/authentik/root/settings.py @@ -233,7 +233,7 @@ TEMPLATES = [ "django.template.context_processors.request", "django.contrib.auth.context_processors.auth", "django.contrib.messages.context_processors.messages", - "authentik.lib.config.context_processor", + "authentik.tenants.utils.context_processor", ], }, }, diff --git a/authentik/tenants/utils.py b/authentik/tenants/utils.py index bcb901a3b..8f340e732 100644 --- a/authentik/tenants/utils.py +++ b/authentik/tenants/utils.py @@ -1,7 +1,10 @@ """Tenant utilities""" +from typing import Any + from django.db.models import Q from django.http.request import HttpRequest +from authentik import __version__ from authentik.tenants.models import Tenant _q_default = Q(default=True) @@ -15,3 +18,8 @@ def get_tenant_for_request(request: HttpRequest) -> Tenant: if not db_tenants.exists(): return Tenant() return db_tenants.first() + + +def context_processor(request: HttpRequest) -> dict[str, Any]: + """Context Processor that injects tenant object into every template""" + return {"tenant": request.tenant, "ak_version": __version__}