From 079538162aa243b7750898d9f81e0c07c16bf38c Mon Sep 17 00:00:00 2001 From: Pierre Jeambrun Date: Wed, 3 Dec 2025 17:01:41 +0100 Subject: [PATCH] [v3-1-test] Fix go back button from fab iframe (#58997) (cherry picked from commit ab8820e2d71e11ef870dc6729d49ab5f9345a506) Co-authored-by: Pierre Jeambrun --- .../src/airflow/ui/src/pages/Security.tsx | 23 ++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/airflow-core/src/airflow/ui/src/pages/Security.tsx b/airflow-core/src/airflow/ui/src/pages/Security.tsx index ab9941fc02ad0..67aefc1dd7a03 100644 --- a/airflow-core/src/airflow/ui/src/pages/Security.tsx +++ b/airflow-core/src/airflow/ui/src/pages/Security.tsx @@ -18,6 +18,7 @@ */ import { Box } from "@chakra-ui/react"; import { useParams } from "react-router-dom"; +import { useNavigate } from "react-router-dom"; import { useAuthLinksServiceGetAuthMenus } from "openapi/queries"; import { ProgressBar } from "src/components/ui"; @@ -37,6 +38,16 @@ export const Security = () => { const link = authLinks?.extra_menu_items.find((mi) => mi.text.toLowerCase().replace(" ", "-") === page); + const navigate = useNavigate(); + + const onLoad = () => { + const iframe: HTMLIFrameElement | null = document.querySelector("#security-iframe"); + + if (iframe?.contentWindow && !iframe.contentWindow.location.pathname.startsWith("/auth/")) { + navigate("/"); + } + }; + if (!link) { if (isLoading) { return ( @@ -51,7 +62,17 @@ export const Security = () => { return ( -