From efe5cda576b607be3ec3c029acb29fcaec435c25 Mon Sep 17 00:00:00 2001 From: Jayasanka Weerasinghe Date: Mon, 6 Jan 2020 15:22:53 +0530 Subject: [PATCH] Fix login redirection in devicemgt react app --- .../io.entgra.device.mgt.ui/react-app/src/pages/Login.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/components/device-mgt/io.entgra.device.mgt.ui/react-app/src/pages/Login.js b/components/device-mgt/io.entgra.device.mgt.ui/react-app/src/pages/Login.js index 3ac1408ba0..8ecd514fd4 100644 --- a/components/device-mgt/io.entgra.device.mgt.ui/react-app/src/pages/Login.js +++ b/components/device-mgt/io.entgra.device.mgt.ui/react-app/src/pages/Login.js @@ -101,7 +101,12 @@ class NormalLoginForm extends React.Component { axios.post(window.location.origin+ config.serverConfig.loginUri, request ).then(res => { if (res.status === 200) { - window.location = window.location.origin+ "/entgra"; + let redirectUrl = window.location.origin + "/entgra"; + const searchParams = new URLSearchParams(window.location.search); + if (searchParams.has("redirect")) { + redirectUrl = searchParams.get("redirect"); + } + window.location = redirectUrl; } }).catch(function (error) { if (error.response.status === 400) {