From a8699d0b87c19009be03b380c0a358bdbde711f3 Mon Sep 17 00:00:00 2001 From: DacongDA Date: Sat, 24 Feb 2024 12:59:09 +0800 Subject: [PATCH] feat: use React routing to remove spin between signup and signin pages (#2740) * fix: Regarding the color of loading * fix: use goToLinkSoft and use same code format with result and forget psw * fix: update signup url --- web/src/Setting.js | 12 ++++++------ web/src/auth/ForgetPage.js | 2 +- web/src/auth/ResultPage.js | 2 +- web/src/auth/SignupPage.js | 6 +++--- 4 files changed, 11 insertions(+), 11 deletions(-) diff --git a/web/src/Setting.js b/web/src/Setting.js index b6526d03..203ae4bd 100644 --- a/web/src/Setting.js +++ b/web/src/Setting.js @@ -1165,7 +1165,7 @@ export function getLoginLink(application) { if (application === null) { url = null; } else if (window.location.pathname.includes("/signup/oauth/authorize")) { - url = window.location.href.replace("/signup/oauth/authorize", "/login/oauth/authorize"); + url = window.location.pathname.replace("/signup/oauth/authorize", "/login/oauth/authorize"); } else if (authConfig.appName === application.name) { url = "/login"; } else if (application.signinUrl === "") { @@ -1173,7 +1173,7 @@ export function getLoginLink(application) { } else { url = application.signinUrl; } - return url; + return url + window.location.search; } export function redirectToLoginPage(application, history) { @@ -1216,7 +1216,7 @@ export function renderSignupLink(application, text) { if (application === null) { url = null; } else if (window.location.pathname.includes("/login/oauth/authorize")) { - url = window.location.href.replace("/login/oauth/authorize", "/signup/oauth/authorize"); + url = window.location.pathname.replace("/login/oauth/authorize", "/signup/oauth/authorize"); } else if (authConfig.appName === application.name) { url = "/signup"; } else { @@ -1228,10 +1228,10 @@ export function renderSignupLink(application, text) { } const storeSigninUrl = () => { - sessionStorage.setItem("signinUrl", window.location.href); + sessionStorage.setItem("signinUrl", window.location.pathname + window.location.search); }; - return renderLink(url, text, storeSigninUrl); + return renderLink(url + window.location.search, text, storeSigninUrl); } export function renderForgetLink(application, text) { @@ -1249,7 +1249,7 @@ export function renderForgetLink(application, text) { } const storeSigninUrl = () => { - sessionStorage.setItem("signinUrl", window.location.href); + sessionStorage.setItem("signinUrl", window.location.pathname + window.location.search); }; return renderLink(url, text, storeSigninUrl); diff --git a/web/src/auth/ForgetPage.js b/web/src/auth/ForgetPage.js index 1e1b9587..0f79a678 100644 --- a/web/src/auth/ForgetPage.js +++ b/web/src/auth/ForgetPage.js @@ -156,7 +156,7 @@ class ForgetPage extends React.Component { if (res.status === "ok") { const linkInStorage = sessionStorage.getItem("signinUrl"); if (linkInStorage !== null && linkInStorage !== "") { - Setting.goToLink(linkInStorage); + Setting.goToLinkSoft(linkInStorage); } else { Setting.redirectToLoginPage(this.getApplicationObj(), this.props.history); } diff --git a/web/src/auth/ResultPage.js b/web/src/auth/ResultPage.js index 1f58ee66..16ce39a6 100644 --- a/web/src/auth/ResultPage.js +++ b/web/src/auth/ResultPage.js @@ -92,7 +92,7 @@ class ResultPage extends React.Component {