From b448e76db4400bfb218fd3d1b625d2f5b1747134 Mon Sep 17 00:00:00 2001 From: "Jens L." Date: Fri, 9 May 2025 17:58:43 +0200 Subject: [PATCH] web/flows/sfe: fix global background image not being loaded (#14442) * web/flows/sfe: add initial loading spinner Signed-off-by: Jens Langhammer * fix brand-level default flow background not working with SFE and loading original image with full flow interface https://github.com/goauthentik/authentik/pull/13079#issuecomment-2853357407 Signed-off-by: Jens Langhammer --------- Signed-off-by: Jens Langhammer --- authentik/flows/templates/if/flow-sfe.html | 3 ++- authentik/flows/templates/if/flow.html | 4 ++-- authentik/flows/views/interface.py | 4 +++- web/packages/sfe/src/index.ts | 9 +++++++++ 4 files changed, 16 insertions(+), 4 deletions(-) diff --git a/authentik/flows/templates/if/flow-sfe.html b/authentik/flows/templates/if/flow-sfe.html index abea71934b..1dc99a80d7 100644 --- a/authentik/flows/templates/if/flow-sfe.html +++ b/authentik/flows/templates/if/flow-sfe.html @@ -15,6 +15,7 @@ {% endblock %} + {% include "base/header_js.html" %} {% endblock %} diff --git a/authentik/flows/views/interface.py b/authentik/flows/views/interface.py index 2806ba782f..d8b1e1cebc 100644 --- a/authentik/flows/views/interface.py +++ b/authentik/flows/views/interface.py @@ -13,7 +13,9 @@ class FlowInterfaceView(InterfaceView): """Flow interface""" def get_context_data(self, **kwargs: Any) -> dict[str, Any]: - kwargs["flow"] = get_object_or_404(Flow, slug=self.kwargs.get("flow_slug")) + flow = get_object_or_404(Flow, slug=self.kwargs.get("flow_slug")) + kwargs["flow"] = flow + kwargs["flow_background_url"] = flow.background_url(self.request) kwargs["inspector"] = "inspector" in self.request.GET return super().get_context_data(**kwargs) diff --git a/web/packages/sfe/src/index.ts b/web/packages/sfe/src/index.ts index a33e54a22a..a4cc79b62f 100644 --- a/web/packages/sfe/src/index.ts +++ b/web/packages/sfe/src/index.ts @@ -47,7 +47,16 @@ class SimpleFlowExecutor { return `${ak().api.base}api/v3/flows/executor/${this.flowSlug}/?query=${encodeURIComponent(window.location.search.substring(1))}`; } + loading() { + this.container.innerHTML = `
+
+ Loading... +
+
`; + } + start() { + this.loading(); $.ajax({ type: "GET", url: this.apiURL,