Fix Bug 66391
This commit is contained in:
parent
08739bbb38
commit
2847ec532d
@ -1,66 +0,0 @@
|
||||
import React from "react";
|
||||
import { inject, observer } from "mobx-react";
|
||||
import { useTranslation } from "react-i18next";
|
||||
|
||||
import { Box } from "@docspace/shared/components/box";
|
||||
import { Button } from "@docspace/shared/components/button";
|
||||
import { ModalDialog } from "@docspace/shared/components/modal-dialog";
|
||||
import { Text } from "@docspace/shared/components/text";
|
||||
|
||||
import StyledModalDialog from "../styled-containers/StyledModalDialog";
|
||||
|
||||
const DisableSsoConfirmationModal = (props) => {
|
||||
const { t } = useTranslation(["SingleSignOn", "Common"]);
|
||||
const {
|
||||
closeConfirmationDisableModal,
|
||||
confirmationDisableModal,
|
||||
confirmDisable,
|
||||
} = props;
|
||||
|
||||
return (
|
||||
<StyledModalDialog
|
||||
contentHeight="100%"
|
||||
displayType="modal"
|
||||
onClose={closeConfirmationDisableModal}
|
||||
visible={confirmationDisableModal}
|
||||
>
|
||||
<ModalDialog.Header>{t("Common:Confirmation")}</ModalDialog.Header>
|
||||
|
||||
<ModalDialog.Body>
|
||||
<Text noSelect>{t("ConfirmationText")}</Text>
|
||||
</ModalDialog.Body>
|
||||
|
||||
<ModalDialog.Footer>
|
||||
<Button
|
||||
id="ok-button"
|
||||
label={t("Common:OKButton")}
|
||||
onClick={confirmDisable}
|
||||
primary
|
||||
scale
|
||||
size="normal"
|
||||
/>
|
||||
<Button
|
||||
id="cancel-button"
|
||||
label={t("Common:CancelButton")}
|
||||
onClick={closeConfirmationDisableModal}
|
||||
scale
|
||||
size="normal"
|
||||
/>
|
||||
</ModalDialog.Footer>
|
||||
</StyledModalDialog>
|
||||
);
|
||||
};
|
||||
|
||||
export default inject(({ ssoStore }) => {
|
||||
const {
|
||||
closeConfirmationDisableModal,
|
||||
confirmationDisableModal,
|
||||
confirmDisable,
|
||||
} = ssoStore;
|
||||
|
||||
return {
|
||||
closeConfirmationDisableModal,
|
||||
confirmationDisableModal,
|
||||
confirmDisable,
|
||||
};
|
||||
})(observer(DisableSsoConfirmationModal));
|
@ -6,21 +6,11 @@ import { Box } from "@docspace/shared/components/box";
|
||||
import { Text } from "@docspace/shared/components/text";
|
||||
import { ToggleButton } from "@docspace/shared/components/toggle-button";
|
||||
import { Badge } from "@docspace/shared/components/badge";
|
||||
import DisableSsoConfirmationModal from "./DisableSsoConfirmationModal";
|
||||
|
||||
const borderProp = { radius: "6px" };
|
||||
|
||||
const ToggleSSO = (props) => {
|
||||
const {
|
||||
theme,
|
||||
enableSso,
|
||||
isSsoEnabled,
|
||||
openConfirmationDisableModal,
|
||||
ssoToggle,
|
||||
confirmationDisableModal,
|
||||
isSSOAvailable,
|
||||
t,
|
||||
} = props;
|
||||
const { theme, enableSso, ssoToggle, isSSOAvailable, t } = props;
|
||||
|
||||
return (
|
||||
<>
|
||||
@ -40,9 +30,7 @@ const ToggleSSO = (props) => {
|
||||
<ToggleButton
|
||||
className="enable-sso toggle"
|
||||
isChecked={enableSso}
|
||||
onChange={
|
||||
isSsoEnabled && enableSso ? openConfirmationDisableModal : ssoToggle
|
||||
}
|
||||
onChange={() => ssoToggle(t)}
|
||||
isDisabled={!isSSOAvailable}
|
||||
/>
|
||||
|
||||
@ -77,28 +65,17 @@ const ToggleSSO = (props) => {
|
||||
</Text>
|
||||
</div>
|
||||
</Box>
|
||||
|
||||
{confirmationDisableModal && <DisableSsoConfirmationModal />}
|
||||
</>
|
||||
);
|
||||
};
|
||||
|
||||
export default inject(({ settingsStore, ssoStore }) => {
|
||||
const { theme } = settingsStore;
|
||||
const {
|
||||
enableSso,
|
||||
isSsoEnabled,
|
||||
openConfirmationDisableModal,
|
||||
ssoToggle,
|
||||
confirmationDisableModal,
|
||||
} = ssoStore;
|
||||
const { enableSso, ssoToggle } = ssoStore;
|
||||
|
||||
return {
|
||||
theme,
|
||||
enableSso,
|
||||
isSsoEnabled,
|
||||
openConfirmationDisableModal,
|
||||
ssoToggle,
|
||||
confirmationDisableModal,
|
||||
};
|
||||
})(withTranslation(["SingleSignOn"])(observer(ToggleSSO)));
|
||||
|
@ -98,7 +98,6 @@ class SsoFormStore {
|
||||
spMetadata = false;
|
||||
idpIsModalVisible = false;
|
||||
spIsModalVisible = false;
|
||||
confirmationDisableModal = false;
|
||||
confirmationResetModal = false;
|
||||
|
||||
// errors
|
||||
@ -155,12 +154,13 @@ class SsoFormStore {
|
||||
}
|
||||
};
|
||||
|
||||
ssoToggle = () => {
|
||||
ssoToggle = (t) => {
|
||||
if (!this.enableSso) {
|
||||
this.enableSso = true;
|
||||
this.serviceProviderSettings = true;
|
||||
} else {
|
||||
this.enableSso = false;
|
||||
!this.hasErrors && this.saveSsoSettings(t);
|
||||
}
|
||||
|
||||
for (let key in this) {
|
||||
@ -224,14 +224,6 @@ class SsoFormStore {
|
||||
this.defaultSettings = defaultSettings;
|
||||
};
|
||||
|
||||
openConfirmationDisableModal = () => {
|
||||
this.confirmationDisableModal = true;
|
||||
};
|
||||
|
||||
closeConfirmationDisableModal = () => {
|
||||
this.confirmationDisableModal = false;
|
||||
};
|
||||
|
||||
openResetModal = () => {
|
||||
this.confirmationResetModal = true;
|
||||
};
|
||||
@ -240,13 +232,6 @@ class SsoFormStore {
|
||||
this.confirmationResetModal = false;
|
||||
};
|
||||
|
||||
confirmDisable = () => {
|
||||
this.resetForm();
|
||||
this.setIsSsoEnabled(false);
|
||||
this.ssoToggle();
|
||||
this.confirmationDisableModal = false;
|
||||
};
|
||||
|
||||
confirmReset = () => {
|
||||
this.resetForm();
|
||||
this.setIsSsoEnabled(false);
|
||||
@ -552,12 +537,12 @@ class SsoFormStore {
|
||||
if (meta.singleSignOnService) {
|
||||
this.ssoUrlPost = this.getPropValue(
|
||||
meta.singleSignOnService,
|
||||
BINDING_POST
|
||||
BINDING_POST,
|
||||
);
|
||||
|
||||
this.ssoUrlRedirect = this.getPropValue(
|
||||
meta.singleSignOnService,
|
||||
BINDING_REDIRECT
|
||||
BINDING_REDIRECT,
|
||||
);
|
||||
}
|
||||
|
||||
@ -568,12 +553,12 @@ class SsoFormStore {
|
||||
|
||||
this.sloUrlRedirect = this.getPropValue(
|
||||
meta.singleLogoutService,
|
||||
BINDING_REDIRECT
|
||||
BINDING_REDIRECT,
|
||||
);
|
||||
|
||||
this.sloUrlPost = this.getPropValue(
|
||||
meta.singleLogoutService,
|
||||
BINDING_POST
|
||||
BINDING_POST,
|
||||
);
|
||||
}
|
||||
|
||||
@ -598,7 +583,7 @@ class SsoFormStore {
|
||||
if (meta.certificate.signing) {
|
||||
if (Array.isArray(meta.certificate.signing)) {
|
||||
meta.certificate.signing = this.getUniqueItems(
|
||||
meta.certificate.signing
|
||||
meta.certificate.signing,
|
||||
).reverse();
|
||||
meta.certificate.signing.forEach((signingCrt) => {
|
||||
data.push({
|
||||
@ -690,14 +675,14 @@ class SsoFormStore {
|
||||
delSpCertificate = (action) => {
|
||||
this.resetSpCheckboxes(action);
|
||||
this.spCertificates = this.spCertificates.filter(
|
||||
(certificate) => certificate.action !== action
|
||||
(certificate) => certificate.action !== action,
|
||||
);
|
||||
};
|
||||
|
||||
delIdpCertificate = (cert) => {
|
||||
this.resetIdpCheckboxes();
|
||||
this.idpCertificates = this.idpCertificates.filter(
|
||||
(certificate) => certificate.crt !== cert
|
||||
(certificate) => certificate.crt !== cert,
|
||||
);
|
||||
};
|
||||
|
||||
@ -713,7 +698,7 @@ class SsoFormStore {
|
||||
(item) =>
|
||||
(item.action === this.spAction ||
|
||||
item.action === SSO_SIGNING_ENCRYPT) &&
|
||||
!this.isEdit
|
||||
!this.isEdit,
|
||||
);
|
||||
};
|
||||
|
||||
@ -785,7 +770,7 @@ class SsoFormStore {
|
||||
|
||||
if (
|
||||
this.idpCertificates.find(
|
||||
(item) => item.crt === this.idpCertificate && !this.isEdit
|
||||
(item) => item.crt === this.idpCertificate && !this.isEdit,
|
||||
)
|
||||
) {
|
||||
toastr.error(t("CertificateExist"));
|
||||
@ -896,7 +881,7 @@ class SsoFormStore {
|
||||
if (!this.enableSso || this.isLoadingXml) return true;
|
||||
return !this.spCertificates.some(
|
||||
(cert) =>
|
||||
cert.action === SSO_SIGNING || cert.action === SSO_SIGNING_ENCRYPT
|
||||
cert.action === SSO_SIGNING || cert.action === SSO_SIGNING_ENCRYPT,
|
||||
);
|
||||
}
|
||||
|
||||
@ -904,7 +889,7 @@ class SsoFormStore {
|
||||
if (!this.enableSso || this.isLoadingXml) return true;
|
||||
return !this.spCertificates.some(
|
||||
(cert) =>
|
||||
cert.action === SSO_ENCRYPT || cert.action === SSO_SIGNING_ENCRYPT
|
||||
cert.action === SSO_ENCRYPT || cert.action === SSO_SIGNING_ENCRYPT,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user