From 9c4b73d77d88e8f2bb84729d79f7ae223f10cb0e Mon Sep 17 00:00:00 2001 From: Will Norris Date: Mon, 4 Dec 2023 14:17:53 -0800 Subject: [PATCH] client/web: handle login client inside an iframe If the login client is inside an iframe, open the management client in a new window, since it can't be loaded in the frame. Updates #10261 Signed-off-by: Will Norris --- client/web/src/components/login-toggle.tsx | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/client/web/src/components/login-toggle.tsx b/client/web/src/components/login-toggle.tsx index 840c66a81..a34d915b2 100644 --- a/client/web/src/components/login-toggle.tsx +++ b/client/web/src/components/login-toggle.tsx @@ -129,9 +129,14 @@ function LoginPopoverContent({ newSession() } else { // Must be connected over Tailscale to log in. - // If not already connected, reroute to the Tailscale IP - // before sending user through check mode. - window.location.href = `http://${node.IP}:5252/?check=now` + // Send user to Tailscale IP and start check mode + const manageURL = `http://${node.IP}:5252/?check=now` + if (window.self !== window.top) { + // if we're inside an iframe, open management client in new window + window.open(manageURL, "_blank") + } else { + window.location.href = manageURL + } } }, [node.IP, auth.viewerIdentity, newSession])