From 49ad6d2aa8b262b503de20c325cc81e93b702c3f Mon Sep 17 00:00:00 2001 From: Jens L Date: Thu, 22 Feb 2024 11:54:59 +0100 Subject: [PATCH] brands: fix context processor when request doesn't have a tenant (#8643) Signed-off-by: Jens Langhammer --- authentik/brands/utils.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/authentik/brands/utils.py b/authentik/brands/utils.py index 6e1db26a53..5e6ef40ed3 100644 --- a/authentik/brands/utils.py +++ b/authentik/brands/utils.py @@ -9,6 +9,7 @@ from sentry_sdk.hub import Hub from authentik import get_full_version from authentik.brands.models import Brand +from authentik.tenants.models import Tenant _q_default = Q(default=True) DEFAULT_BRAND = Brand(domain="fallback") @@ -30,13 +31,14 @@ def get_brand_for_request(request: HttpRequest) -> Brand: def context_processor(request: HttpRequest) -> dict[str, Any]: """Context Processor that injects brand object into every template""" brand = getattr(request, "brand", DEFAULT_BRAND) + tenant = getattr(request, "tenant", Tenant()) trace = "" span = Hub.current.scope.span if span: trace = span.to_traceparent() return { "brand": brand, - "footer_links": request.tenant.footer_links, + "footer_links": tenant.footer_links, "sentry_trace": trace, "version": get_full_version(), }