From 4714ebbc048e924fd5fb47580839a56246e392b5 Mon Sep 17 00:00:00 2001 From: Sasa Jovicic Date: Thu, 26 Oct 2023 11:21:45 +0200 Subject: [PATCH] Fix: login rerouting only works on the user's current tab (PR:#14399) Signed-off-by: Sasa Jovicic --- awx/ui/src/contexts/Session.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/awx/ui/src/contexts/Session.js b/awx/ui/src/contexts/Session.js index d0a92d752319..3ed211a49e4d 100644 --- a/awx/ui/src/contexts/Session.js +++ b/awx/ui/src/contexts/Session.js @@ -115,8 +115,11 @@ function SessionProvider({ children }) { }, [setSessionTimeout, setSessionCountdown]); useEffect(() => { + const isRedirectCondition = (location, histLength) => + location.pathname === '/login' && histLength === 2; + const unlisten = history.listen((location, action) => { - if (action === 'POP') { + if (action === 'POP' || isRedirectCondition(location, history.length) ) { setIsRedirectLinkReceived(true); } });