From 6598fe7cfed08121a61f40277059b19d8ab775ea Mon Sep 17 00:00:00 2001 From: Frikky Date: Wed, 5 Mar 2025 14:09:13 +0100 Subject: [PATCH] Fixed an issue where SSO URL was not being parsed on the login page --- frontend/src/context/ContextApi.jsx | 13 +++++++++---- frontend/src/views/Docs.jsx | 3 +-- frontend/src/views/LoginPage.jsx | 28 ++++++++++++++++++++++++++++ frontend/src/views/LoginPageOld.jsx | 2 +- 4 files changed, 39 insertions(+), 7 deletions(-) diff --git a/frontend/src/context/ContextApi.jsx b/frontend/src/context/ContextApi.jsx index 3932dfd0..4e82ba1e 100644 --- a/frontend/src/context/ContextApi.jsx +++ b/frontend/src/context/ContextApi.jsx @@ -1,14 +1,15 @@ -import { createContext, useState, useEffect } from 'react'; +import React, { createContext, useState, useEffect } from 'react'; export const Context = createContext(); -export const AppContext =(props) => { +export const AppContext = (props) => { + const { serverside } = props - const currentLocation = window?.location?.pathname; + const currentLocation = serverside === true ? "" : window?.location?.pathname; // Left side bar global states const [searchBarModalOpen, setSearchBarModalOpen] = useState(false); const [leftSideBarOpenByClick, setLeftSideBarOpenByClick] = useState(currentLocation?.includes('/workflows/') ? false : true) - const [windowWidth, setWindowWidth] = useState(window.innerWidth); + const [windowWidth, setWindowWidth] = useState(serverside === true ? 100 : window.innerWidth); useEffect(() => { if (currentLocation?.includes('/workflows/') && leftSideBarOpenByClick === true) { @@ -18,6 +19,10 @@ export const AppContext =(props) => { //Calculate window width useEffect(() => { + if (serverside === true) { + return + } + const handleResize = () => { setWindowWidth(window?.innerWidth); }; diff --git a/frontend/src/views/Docs.jsx b/frontend/src/views/Docs.jsx index 7a9c371e..6aa8ec08 100755 --- a/frontend/src/views/Docs.jsx +++ b/frontend/src/views/Docs.jsx @@ -694,8 +694,7 @@ const Docs = (defaultprops) => { - - {extraInfo && userdata?.support} + {isArticlePage ? (userdata?.support ? extraInfo : "") : extraInfo} ) } diff --git a/frontend/src/views/LoginPage.jsx b/frontend/src/views/LoginPage.jsx index 02a2967f..385a2d8e 100755 --- a/frontend/src/views/LoginPage.jsx +++ b/frontend/src/views/LoginPage.jsx @@ -282,6 +282,8 @@ const LoginPage = props => { const [register, setRegister] = useState(inregister); const [checkboxClicked, setCheckboxClicked] = useState(false); const [loginWithSSO, setLoginWithSSO] = useState(false) + + const [ssoUrl, setSSOUrl] = useState(""); const isCloud = window.location.host === "localhost:3002" || window.location.host === "shuffler.io" || window.location.host === "migration.shuffler.io"; const parsedsearch = serverside === true ? "" : window.location.search @@ -438,6 +440,9 @@ const LoginPage = props => { if (responseJson["success"] === false) { setLoginInfo(responseJson["reason"]); } else { + if (responseJson.sso_url !== undefined && responseJson.sso_url !== null) { + setSSOUrl(responseJson.sso_url); + } // Stay = 0 users // Redirect = >1 user @@ -901,6 +906,29 @@ const LoginPage = props => {
{loginInfo}
+ + {ssoUrl !== undefined && ssoUrl !== null && ssoUrl.length > 0 ? ( +
+ Or +
+ +
+
+ ) : null} diff --git a/frontend/src/views/LoginPageOld.jsx b/frontend/src/views/LoginPageOld.jsx index 6b34b957..541cd903 100755 --- a/frontend/src/views/LoginPageOld.jsx +++ b/frontend/src/views/LoginPageOld.jsx @@ -498,7 +498,7 @@ const LoginDialog = (props) => {