Support "signinUrl" in forget page

This commit is contained in:
Yang Luo
2024-02-14 02:36:52 +08:00
parent 75699c4a26
commit bcfbfc6947
2 changed files with 12 additions and 2 deletions

View File

@ -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) {

View File

@ -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);
}