mirror of
https://github.com/casdoor/casdoor.git
synced 2025-07-04 05:10:19 +08:00
feat: can redirect user to login page after linking provider in prompt page (#3820)
This commit is contained in:
@ -193,7 +193,11 @@ class AuthCallback extends React.Component {
|
|||||||
const token = res.data;
|
const token = res.data;
|
||||||
Setting.goToLink(`${oAuthParams.redirectUri}${concatChar}${responseType}=${token}&state=${oAuthParams.state}&token_type=bearer`);
|
Setting.goToLink(`${oAuthParams.redirectUri}${concatChar}${responseType}=${token}&state=${oAuthParams.state}&token_type=bearer`);
|
||||||
} else if (responseType === "link") {
|
} else if (responseType === "link") {
|
||||||
const from = innerParams.get("from");
|
let from = innerParams.get("from");
|
||||||
|
const oauth = innerParams.get("oauth");
|
||||||
|
if (oauth) {
|
||||||
|
from += `?oauth=${oauth}`;
|
||||||
|
}
|
||||||
Setting.goToLinkSoftOrJumpSelf(this, from);
|
Setting.goToLinkSoftOrJumpSelf(this, from);
|
||||||
} else if (responseType === "saml") {
|
} else if (responseType === "saml") {
|
||||||
if (res.data2.method === "POST") {
|
if (res.data2.method === "POST") {
|
||||||
|
@ -194,8 +194,10 @@ class PromptPage extends React.Component {
|
|||||||
const redirectUri = params.get("redirectUri");
|
const redirectUri = params.get("redirectUri");
|
||||||
const code = params.get("code");
|
const code = params.get("code");
|
||||||
const state = params.get("state");
|
const state = params.get("state");
|
||||||
|
const oauth = params.get("oauth");
|
||||||
if (redirectUri === null || code === null || state === null) {
|
if (redirectUri === null || code === null || state === null) {
|
||||||
return "";
|
const signInUrl = sessionStorage.getItem("signinUrl");
|
||||||
|
return oauth === "true" ? signInUrl : "";
|
||||||
}
|
}
|
||||||
return `${redirectUri}?code=${code}&state=${state}`;
|
return `${redirectUri}?code=${code}&state=${state}`;
|
||||||
}
|
}
|
||||||
|
@ -195,8 +195,9 @@ class SignupPage extends React.Component {
|
|||||||
if (authConfig.appName === application.name) {
|
if (authConfig.appName === application.name) {
|
||||||
return "/result";
|
return "/result";
|
||||||
} else {
|
} else {
|
||||||
|
const oAuthParams = Util.getOAuthGetParameters();
|
||||||
if (Setting.hasPromptPage(application)) {
|
if (Setting.hasPromptPage(application)) {
|
||||||
return `/prompt/${application.name}`;
|
return `/prompt/${application.name}?oauth=${oAuthParams !== null}`;
|
||||||
} else {
|
} else {
|
||||||
return `/result/${application.name}`;
|
return `/result/${application.name}`;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user