From 1ceebb275ce307ff71490474733e1160da1b6fcc 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 d0a92d7523..26f915e1d5 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); } });