mirror of
https://github.com/casdoor/casdoor.git
synced 2025-05-23 18:54:03 +08:00
fix: invalid redirect url after sign up (#896)
* fix: invalid redirect url after sign up Signed-off-by: Yixiang Zhao <seriouszyx@foxmail.com> * Update App.js * Update Setting.js Co-authored-by: Yang Luo <hsluoyz@qq.com>
This commit is contained in:
parent
1839252c30
commit
48b5b27982
@ -669,7 +669,8 @@ class App extends Component {
|
|||||||
<Route exact path="/signup" render={(props) => this.renderHomeIfLoggedIn(<SignupPage account={this.state.account} {...props} />)} />
|
<Route exact path="/signup" render={(props) => this.renderHomeIfLoggedIn(<SignupPage account={this.state.account} {...props} />)} />
|
||||||
<Route exact path="/signup/:applicationName" render={(props) => this.renderHomeIfLoggedIn(<SignupPage account={this.state.account} {...props} onUpdateAccount={(account) => {this.onUpdateAccount(account);}} />)} />
|
<Route exact path="/signup/:applicationName" render={(props) => this.renderHomeIfLoggedIn(<SignupPage account={this.state.account} {...props} onUpdateAccount={(account) => {this.onUpdateAccount(account);}} />)} />
|
||||||
<Route exact path="/login" render={(props) => this.renderHomeIfLoggedIn(<SelfLoginPage account={this.state.account} {...props} />)} />
|
<Route exact path="/login" render={(props) => this.renderHomeIfLoggedIn(<SelfLoginPage account={this.state.account} {...props} />)} />
|
||||||
<Route exact path="/signup/oauth/authorize" render={(props) => <LoginPage account={this.state.account} type={"code"} mode={"signup"} {...props} onUpdateAccount={(account) => {this.onUpdateAccount(account);}} />} />
|
<Route exact path="/auto-signup/oauth/authorize" render={(props) => <LoginPage account={this.state.account} type={"code"} mode={"signup"} {...props} onUpdateAccount={(account) => {this.onUpdateAccount(account);}} />} />
|
||||||
|
<Route exact path="/signup/oauth/authorize" render={(props) => <SignupPage account={this.state.account} {...props} onUpdateAccount={(account) => {this.onUpdateAccount(account);}} />} />
|
||||||
<Route exact path="/login/oauth/authorize" render={(props) => <LoginPage account={this.state.account} type={"code"} mode={"signin"} {...props} onUpdateAccount={(account) => {this.onUpdateAccount(account);}} />} />
|
<Route exact path="/login/oauth/authorize" render={(props) => <LoginPage account={this.state.account} type={"code"} mode={"signin"} {...props} onUpdateAccount={(account) => {this.onUpdateAccount(account);}} />} />
|
||||||
<Route exact path="/login/saml/authorize/:owner/:applicationName" render={(props) => <LoginPage account={this.state.account} type={"saml"} mode={"signin"} {...props} onUpdateAccount={(account) => {this.onUpdateAccount(account);}} />} />
|
<Route exact path="/login/saml/authorize/:owner/:applicationName" render={(props) => <LoginPage account={this.state.account} type={"saml"} mode={"signin"} {...props} onUpdateAccount={(account) => {this.onUpdateAccount(account);}} />} />
|
||||||
<Route exact path="/cas/:owner/:casApplicationName/logout" render={(props) => this.renderHomeIfLoggedIn(<CasLogout clearAccount={() => this.setState({account: null})} {...props} />)} />
|
<Route exact path="/cas/:owner/:casApplicationName/logout" render={(props) => this.renderHomeIfLoggedIn(<CasLogout clearAccount={() => this.setState({account: null})} {...props} />)} />
|
||||||
|
@ -662,8 +662,8 @@ export function goToLogin(ths, application) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!application.enablePassword && window.location.pathname.includes("/signup/oauth/authorize")) {
|
if (!application.enablePassword && window.location.pathname.includes("/auto-signup/oauth/authorize")) {
|
||||||
const link = window.location.href.replace("/signup/oauth/authorize", "/login/oauth/authorize");
|
const link = window.location.href.replace("/auto-signup/oauth/authorize", "/login/oauth/authorize");
|
||||||
goToLink(link);
|
goToLink(link);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -685,7 +685,7 @@ export function goToSignup(ths, application) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!application.enablePassword && window.location.pathname.includes("/login/oauth/authorize")) {
|
if (!application.enablePassword && window.location.pathname.includes("/login/oauth/authorize")) {
|
||||||
const link = window.location.href.replace("/login/oauth/authorize", "/signup/oauth/authorize");
|
const link = window.location.href.replace("/login/oauth/authorize", "/auto-signup/oauth/authorize");
|
||||||
goToLink(link);
|
goToLink(link);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -79,19 +79,28 @@ class SignupPage extends React.Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
UNSAFE_componentWillMount() {
|
UNSAFE_componentWillMount() {
|
||||||
if (this.state.applicationName !== undefined) {
|
let applicationName = this.state.applicationName;
|
||||||
this.getApplication();
|
const oAuthParams = Util.getOAuthGetParameters();
|
||||||
|
if (oAuthParams !== null) {
|
||||||
|
applicationName = oAuthParams.state;
|
||||||
|
this.setState({applicationName: oAuthParams.state});
|
||||||
|
const signinUrl = window.location.href.replace("/signup/oauth/authorize", "/login/oauth/authorize");
|
||||||
|
sessionStorage.setItem("signinUrl", signinUrl);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (applicationName !== undefined) {
|
||||||
|
this.getApplication(applicationName);
|
||||||
} else {
|
} else {
|
||||||
Util.showMessage("error", `Unknown application name: ${this.state.applicationName}`);
|
Util.showMessage("error", `Unknown application name: ${applicationName}`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
getApplication() {
|
getApplication(applicationName) {
|
||||||
if (this.state.applicationName === undefined) {
|
if (applicationName === undefined) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
ApplicationBackend.getApplication("admin", this.state.applicationName)
|
ApplicationBackend.getApplication("admin", applicationName)
|
||||||
.then((application) => {
|
.then((application) => {
|
||||||
this.setState({
|
this.setState({
|
||||||
application: application,
|
application: application,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user