From cc326ddb84db5e5d41198e4b45d89072cac28c93 Mon Sep 17 00:00:00 2001 From: Aurora Lahtela <24460436+AuroraLS3@users.noreply.github.com> Date: Sun, 28 Aug 2022 18:17:25 +0300 Subject: [PATCH] Fix login redirect on from parameter on React login page --- Plan/react/dashboard/src/views/layout/LoginPage.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/Plan/react/dashboard/src/views/layout/LoginPage.js b/Plan/react/dashboard/src/views/layout/LoginPage.js index 3bacfb4da..ff10e9899 100644 --- a/Plan/react/dashboard/src/views/layout/LoginPage.js +++ b/Plan/react/dashboard/src/views/layout/LoginPage.js @@ -12,6 +12,7 @@ import drawSine from "../../util/loginSineRenderer"; import {fetchLogin} from "../../service/authenticationService"; import ForgotPasswordModal from "../../components/modal/ForgotPasswordModal"; import {useAuth} from "../../hooks/authenticationHook"; +import {baseAddress} from "../../service/backendConfiguration"; const Logo = () => { return ( @@ -163,11 +164,11 @@ const LoginPage = () => { setFailMessage(t('html.login.failed') + (error.data && error.data.error ? error.data.error : error.message)); } } else if (data && data.success) { + await updateLoginDetails(); if (redirectTo && !redirectTo.startsWith('http') && !redirectTo.startsWith('file') && !redirectTo.startsWith('javascript')) { - navigate(redirectTo.substring(redirectTo.indexOf('/'))) + navigate(baseAddress + redirectTo.substring(redirectTo.indexOf('/')) + (window.location.hash ? window.location.hash : '')); } else { - await updateLoginDetails(); - navigate('../'); + navigate(baseAddress + '/'); } } else { setFailMessage(t('html.login.failed') + data ? data.error : t('generic.noData'));