From d43eda8ff03c80cead1acf461c83d34ef6c523da Mon Sep 17 00:00:00 2001 From: Jeremy Clements <79224539+jeclrsg@users.noreply.github.com> Date: Tue, 28 Nov 2023 14:17:08 -0500 Subject: [PATCH] HPCC-30934 ECL Watch v9 fix unlock page redirect redirect to the last visited page instead of always going to "/index.html" Signed-off-by: Jeremy Clements <79224539+jeclrsg@users.noreply.github.com> --- esp/src/src-react/components/forms/Login.tsx | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/esp/src/src-react/components/forms/Login.tsx b/esp/src/src-react/components/forms/Login.tsx index 6b1d324b0fb..9937ee68394 100644 --- a/esp/src/src-react/components/forms/Login.tsx +++ b/esp/src/src-react/components/forms/Login.tsx @@ -120,7 +120,9 @@ export const Login: React.FunctionComponent = ({ cookies["ESPAuthenticated"] = "true"; createUserSession(cookies).then(() => { setErrorMessage(""); - replaceUrl("/", true); + const lastUrl = window.localStorage.getItem("pageOnLock") ?? "/"; + window.localStorage.removeItem("pageOnLock"); + replaceUrl(lastUrl, true); }).catch(err => logger.error("Unable to create user session.")); } }