Login: fix consent screen

This commit is contained in:
Timofey Boyko 2023-10-27 11:55:30 +03:00
parent a4f555b853
commit 348383e2fb
2 changed files with 9 additions and 13 deletions

View File

@ -20,9 +20,10 @@ import Link from "@docspace/components/link";
import Avatar from "@docspace/components/avatar"; import Avatar from "@docspace/components/avatar";
//@ts-ignore //@ts-ignore
import { Base } from "@docspace/components/themes"; import { Base } from "@docspace/components/themes";
//@ts-ignore
import { getCookie } from "@docspace/components/utils/cookie";
import OAuthClientInfo from "./oauth-client-info"; import OAuthClientInfo from "./oauth-client-info";
import { getCookie } from "@docspace/common/utils";
const StyledFormWrapper = styled(FormWrapper)` const StyledFormWrapper = styled(FormWrapper)`
width: 416px; width: 416px;

View File

@ -61,7 +61,13 @@ app.get("*", async (req: ILoginRequest, res: Response, next) => {
try { try {
const isAuth = await checkIsAuthenticated(); const isAuth = await checkIsAuthenticated();
if (isAuth && url !== "/login/error") { const oauthClientId = (query.client_id as string) || "";
const oauthClientState = (query.state as string) || "";
const isOAuth = query.type === "oauth2" && !!oauthClientId;
const isConsent = isAuth && isOAuth && oauthClientState;
if (isAuth && !isOAuth && url !== "/login/error") {
res.redirect("/"); res.redirect("/");
return next(); return next();
} }
@ -70,12 +76,6 @@ app.get("*", async (req: ILoginRequest, res: Response, next) => {
const hideAuthPage = initialState?.ssoSettings?.hideAuthPage; const hideAuthPage = initialState?.ssoSettings?.hideAuthPage;
const ssoUrl = initialState?.capabilities?.ssoUrl; const ssoUrl = initialState?.capabilities?.ssoUrl;
const oauthClientId = initialState.match?.client_id || "";
const oauthClientState = initialState.match?.state || "";
const isOAuth = initialState.match?.type === "oauth2" && !!oauthClientId;
const isConsent = isAuth && isOAuth;
if (hideAuthPage && ssoUrl && query.skipssoredirect !== "true") { if (hideAuthPage && ssoUrl && query.skipssoredirect !== "true") {
res.redirect(ssoUrl); res.redirect(ssoUrl);
return next(); return next();
@ -99,11 +99,6 @@ app.get("*", async (req: ILoginRequest, res: Response, next) => {
} }
} }
if (initialState.isAuth && !isCorrectOAuth && url !== "/login/error") {
res.redirect("/");
return next();
}
if (initialState?.portalSettings?.wizardToken) { if (initialState?.portalSettings?.wizardToken) {
res.redirect("/wizard"); res.redirect("/wizard");
return next(); return next();