Skip to content

Commit

Permalink
Merge pull request wso2#5508 from pavinduLakshan/fix_suborg_login_flow
Browse files Browse the repository at this point in the history
  • Loading branch information
pavinduLakshan authored Feb 13, 2024
2 parents 895d406 + b8b9ebc commit ca9731a
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 5 deletions.
5 changes: 5 additions & 0 deletions .changeset/bright-apricots-hang.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@wso2is/console": patch
---

Send empty string when conditional auth is disabled for sub organizations
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
import Alert from "@oxygen-ui/react/Alert";
import AlertTitle from "@oxygen-ui/react/AlertTitle";
import Button from "@oxygen-ui/react/Button";
import { OrganizationType } from "@wso2is/common";
import { AlertLevels, IdentifiableComponentInterface } from "@wso2is/core/models";
import { addAlert } from "@wso2is/core/store";
import { DocumentationLink, useDocumentation } from "@wso2is/react-components";
Expand All @@ -38,7 +39,7 @@ import React, {
useState
} from "react";
import { Trans, useTranslation } from "react-i18next";
import { useDispatch } from "react-redux";
import { useDispatch, useSelector } from "react-redux";
import ReactFlow, {
Background,
BackgroundVariant,
Expand Down Expand Up @@ -70,6 +71,7 @@ import {
} from "../../applications/utils/adaptive-script-utils";
import { AuthenticatorManagementConstants } from "../../connections";
import useMultiFactorAuthenticatorDetails from "../../connections/api/use-multi-factor-authentication-details";
import { AppState } from "../../core";
import { IdentityProviderManagementConstants } from "../../identity-providers/constants";
import { ConnectorPropertyInterface } from "../../server-configurations";
import useAuthenticationFlow from "../hooks/use-authentication-flow";
Expand Down Expand Up @@ -152,6 +154,9 @@ const AuthenticationFlowVisualEditor: FunctionComponent<AuthenticationFlowVisual

const infoAlertRef: MutableRefObject<HTMLDivElement> = useRef<HTMLDivElement>(null);

const orgType: OrganizationType = useSelector((state: AppState) =>
state?.organization?.organizationType);

const [ authenticatorAddStep, setAuthenticatorAddStep ] = useState<number>(0);
const [ showAuthenticatorAddModal, setShowAuthenticatorAddModal ] = useState<boolean>(false);
const [ showRevertDisclaimerModal, setShowRevertDisclaimerModal ] = useState<boolean>(false);
Expand Down Expand Up @@ -515,10 +520,18 @@ const AuthenticationFlowVisualEditor: FunctionComponent<AuthenticationFlowVisual
: AuthenticationSequenceType.USER_DEFINED
};

if (!isAdaptiveAuthAvailable
|| !isConditionalAuthenticationEnabled
|| AdaptiveScriptUtils.isEmptyScript(authenticationSequence.script)) {
sequence.script = AdaptiveScriptUtils.generateScript(authenticationSequence?.steps?.length + 1).join("\n");
if (
!isAdaptiveAuthAvailable
|| !isConditionalAuthenticationEnabled
|| AdaptiveScriptUtils.isEmptyScript(authenticationSequence.script)
) {
sequence.script = AdaptiveScriptUtils.generateScript(
authenticationSequence?.steps?.length + 1).join("\n"
);
}

if (orgType === OrganizationType.SUBORGANIZATION) {
sequence.script = "";
}

// Update the modified script state in the context.
Expand Down

0 comments on commit ca9731a

Please sign in to comment.