Fixed an issue where SSO URL was not being parsed on the login page
This commit is contained in:
@@ -1,14 +1,15 @@
|
|||||||
import { createContext, useState, useEffect } from 'react';
|
import React, { createContext, useState, useEffect } from 'react';
|
||||||
export const Context = createContext();
|
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
|
// Left side bar global states
|
||||||
const [searchBarModalOpen, setSearchBarModalOpen] = useState(false);
|
const [searchBarModalOpen, setSearchBarModalOpen] = useState(false);
|
||||||
const [leftSideBarOpenByClick, setLeftSideBarOpenByClick] = useState(currentLocation?.includes('/workflows/') ? false : true)
|
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(() => {
|
useEffect(() => {
|
||||||
if (currentLocation?.includes('/workflows/') && leftSideBarOpenByClick === true) {
|
if (currentLocation?.includes('/workflows/') && leftSideBarOpenByClick === true) {
|
||||||
@@ -18,6 +19,10 @@ export const AppContext =(props) => {
|
|||||||
|
|
||||||
//Calculate window width
|
//Calculate window width
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
if (serverside === true) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
const handleResize = () => {
|
const handleResize = () => {
|
||||||
setWindowWidth(window?.innerWidth);
|
setWindowWidth(window?.innerWidth);
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -694,8 +694,7 @@ const Docs = (defaultprops) => {
|
|||||||
<LinkIcon />
|
<LinkIcon />
|
||||||
</Link>
|
</Link>
|
||||||
</div>
|
</div>
|
||||||
|
{isArticlePage ? (userdata?.support ? extraInfo : "") : extraInfo}
|
||||||
{extraInfo && userdata?.support}
|
|
||||||
</Typography>
|
</Typography>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -283,6 +283,8 @@ const LoginPage = props => {
|
|||||||
const [checkboxClicked, setCheckboxClicked] = useState(false);
|
const [checkboxClicked, setCheckboxClicked] = useState(false);
|
||||||
const [loginWithSSO, setLoginWithSSO] = 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 isCloud = window.location.host === "localhost:3002" || window.location.host === "shuffler.io" || window.location.host === "migration.shuffler.io";
|
||||||
const parsedsearch = serverside === true ? "" : window.location.search
|
const parsedsearch = serverside === true ? "" : window.location.search
|
||||||
|
|
||||||
@@ -438,6 +440,9 @@ const LoginPage = props => {
|
|||||||
if (responseJson["success"] === false) {
|
if (responseJson["success"] === false) {
|
||||||
setLoginInfo(responseJson["reason"]);
|
setLoginInfo(responseJson["reason"]);
|
||||||
} else {
|
} else {
|
||||||
|
if (responseJson.sso_url !== undefined && responseJson.sso_url !== null) {
|
||||||
|
setSSOUrl(responseJson.sso_url);
|
||||||
|
}
|
||||||
|
|
||||||
// Stay = 0 users
|
// Stay = 0 users
|
||||||
// Redirect = >1 user
|
// Redirect = >1 user
|
||||||
@@ -901,6 +906,29 @@ const LoginPage = props => {
|
|||||||
<div style={{ marginTop: "10px", color: "white" }}>
|
<div style={{ marginTop: "10px", color: "white" }}>
|
||||||
{loginInfo}
|
{loginInfo}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
{ssoUrl !== undefined && ssoUrl !== null && ssoUrl.length > 0 ? (
|
||||||
|
<div>
|
||||||
|
<Typography style={{ textAlign: "center" }}>Or</Typography>
|
||||||
|
<div style={{ textAlign: "center", margin: 10 }}>
|
||||||
|
<Button
|
||||||
|
fullWidth
|
||||||
|
id="sso_button"
|
||||||
|
color="secondary"
|
||||||
|
variant="outlined"
|
||||||
|
type="button"
|
||||||
|
style={{ flex: "1", marginTop: 5 }}
|
||||||
|
onClick={() => {
|
||||||
|
//console.log("CLICK SSO");
|
||||||
|
window.location.href = ssoUrl
|
||||||
|
//navigate(ssoUrl)
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
Use SSO
|
||||||
|
</Button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
) : null}
|
||||||
</form>
|
</form>
|
||||||
</Paper>
|
</Paper>
|
||||||
|
|
||||||
|
|||||||
@@ -498,7 +498,7 @@ const LoginDialog = (props) => {
|
|||||||
<div style={{ textAlign: "center", margin: 10 }}>
|
<div style={{ textAlign: "center", margin: 10 }}>
|
||||||
<Button
|
<Button
|
||||||
fullWidth
|
fullWidth
|
||||||
id="sso_button"
|
id="sso_button"
|
||||||
color="secondary"
|
color="secondary"
|
||||||
variant="outlined"
|
variant="outlined"
|
||||||
type="button"
|
type="button"
|
||||||
|
|||||||
Reference in New Issue
Block a user