diff --git a/web/src/auth/LoginPage.js b/web/src/auth/LoginPage.js index 6407b205..8461fbfb 100644 --- a/web/src/auth/LoginPage.js +++ b/web/src/auth/LoginPage.js @@ -207,6 +207,7 @@ class LoginPage extends React.Component { } else if (responseType === "code") { const code = res.data; const concatChar = oAuthParams?.redirectUri?.includes("?") ? "&" : "?"; + const noRedirect = oAuthParams.noRedirect; if (Setting.hasPromptPage(application)) { AuthBackend.getAccount("") @@ -228,7 +229,19 @@ class LoginPage extends React.Component { } }); } else { - Setting.goToLink(`${oAuthParams.redirectUri}${concatChar}code=${code}&state=${oAuthParams.state}`); + if (noRedirect === "true") { + window.close(); + const newWindow = window.open(`${oAuthParams.redirectUri}${concatChar}code=${code}&state=${oAuthParams.state}`); + if (newWindow) { + setInterval(() => { + if (!newWindow.closed) { + newWindow.close(); + } + }, 1000); + } + } else { + Setting.goToLink(`${oAuthParams.redirectUri}${concatChar}code=${code}&state=${oAuthParams.state}`); + } } // Util.showMessage("success", `Authorization code: ${res.data}`); diff --git a/web/src/auth/Util.js b/web/src/auth/Util.js index 80e4e5b4..1a9a9fa7 100644 --- a/web/src/auth/Util.js +++ b/web/src/auth/Util.js @@ -103,6 +103,7 @@ export function getOAuthGetParameters(params) { const codeChallenge = getRefinedValue(queries.get("code_challenge")); const samlRequest = getRefinedValue(queries.get("SAMLRequest")); const relayState = getRefinedValue(queries.get("RelayState")); + const noRedirect = getRefinedValue(queries.get("noRedirect")); if ((clientId === undefined || clientId === null || clientId === "") && (samlRequest === "" || samlRequest === undefined)) { // login @@ -120,6 +121,7 @@ export function getOAuthGetParameters(params) { codeChallenge: codeChallenge, samlRequest: samlRequest, relayState: relayState, + noRedirect: noRedirect, }; } }