From a118893a2fb9c1553d2a9b98e37bc6958cc8357e Mon Sep 17 00:00:00 2001 From: Julian Kepka Date: Wed, 12 Aug 2026 16:42:48 +0200 Subject: [PATCH] fix: user-settings redirect to login if kratos session invalid --- src/app/(loading-group)/user-settings/page.tsx | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/app/(loading-group)/user-settings/page.tsx b/src/app/(loading-group)/user-settings/page.tsx index 4f9d6f6d2..2f25d0a9d 100644 --- a/src/app/(loading-group)/user-settings/page.tsx +++ b/src/app/(loading-group)/user-settings/page.tsx @@ -13,14 +13,20 @@ // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . +import { fetchSession } from "@/data-fetcher/fetchSession"; import oryConfig from "@/ory.config"; import { getSettingsFlow } from "@ory/nextjs/app"; import type { OryPageParams } from "@ory/nextjs/app"; +import { redirect } from "next/navigation"; import Page from "../../../components/Page"; import UserSettings from "../../../components/UserSettings"; import PatManagementSection from "./PatManagementSection"; const SettingsPage = async (props: OryPageParams) => { + if (!(await fetchSession())) { + redirect("/login?return_to=/user-settings"); + } + const flow = await getSettingsFlow(oryConfig, props.searchParams); if (!flow) {