diff --git a/web/src/Setting.js b/web/src/Setting.js index a5ea98dc..48d78369 100644 --- a/web/src/Setting.js +++ b/web/src/Setting.js @@ -1253,7 +1253,11 @@ export function renderForgetLink(application, text) { } } - return renderLink(url, text, null); + const storeSigninUrl = () => { + sessionStorage.setItem("signinUrl", window.location.href); + }; + + return renderLink(url, text, storeSigninUrl); } export function renderHelmet(application) { diff --git a/web/src/auth/ForgetPage.js b/web/src/auth/ForgetPage.js index 2ec2344d..1e1b9587 100644 --- a/web/src/auth/ForgetPage.js +++ b/web/src/auth/ForgetPage.js @@ -47,6 +47,7 @@ class ForgetPage extends React.Component { this.form = React.createRef(); } + componentDidMount() { if (this.getApplicationObj() === undefined) { if (this.state.applicationName !== undefined) { @@ -153,7 +154,12 @@ class ForgetPage extends React.Component { values.userOwner = this.getApplicationObj()?.organizationObj.name; UserBackend.setPassword(values.userOwner, values.username, "", values?.newPassword, this.state.code).then(res => { if (res.status === "ok") { - Setting.redirectToLoginPage(this.getApplicationObj(), this.props.history); + const linkInStorage = sessionStorage.getItem("signinUrl"); + if (linkInStorage !== null && linkInStorage !== "") { + Setting.goToLink(linkInStorage); + } else { + Setting.redirectToLoginPage(this.getApplicationObj(), this.props.history); + } } else { Setting.showMessage("error", res.msg); }