From 7d4fa631aea8cdece60531887c1a7c625cfc1b14 Mon Sep 17 00:00:00 2001 From: Lectom Date: Tue, 23 Jun 2026 08:41:40 +0900 Subject: [PATCH] Show orgfront login page for regular entries --- orgfront/src/features/auth/AuthGuard.test.tsx | 8 ++++++++ orgfront/src/features/auth/AuthGuard.tsx | 5 ++++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/orgfront/src/features/auth/AuthGuard.test.tsx b/orgfront/src/features/auth/AuthGuard.test.tsx index 478e9edf..d520f1c2 100644 --- a/orgfront/src/features/auth/AuthGuard.test.tsx +++ b/orgfront/src/features/auth/AuthGuard.test.tsx @@ -36,6 +36,7 @@ function renderGuard(initialEntry: string) { }> + chart} /> picker} /> } /> @@ -74,4 +75,11 @@ describe("OrgFront AuthGuard auto login redirects", () => { ); cleanupRendered(rendered.container, rendered.root); }); + + it("redirects regular app entry to the visible login page", () => { + const rendered = renderGuard("/chart"); + + expect(rendered.container.textContent).toBe("/login?returnTo=%2Fchart"); + cleanupRendered(rendered.container, rendered.root); + }); }); diff --git a/orgfront/src/features/auth/AuthGuard.tsx b/orgfront/src/features/auth/AuthGuard.tsx index a964548b..fabe1d16 100644 --- a/orgfront/src/features/auth/AuthGuard.tsx +++ b/orgfront/src/features/auth/AuthGuard.tsx @@ -29,9 +29,12 @@ export default function AuthGuard() { if (!auth.isAuthenticated) { const returnTo = `${location.pathname}${location.search}`; + const autoLoginParam = location.pathname.startsWith("/embed/") + ? "auto=1&" + : ""; return ( );