2020-11-25 16:17:50 +00:00
|
|
|
import { FormGroup, Switch } from "@patternfly/react-core";
|
2020-10-30 20:15:37 +00:00
|
|
|
import { useTranslation } from "react-i18next";
|
2021-01-26 01:41:14 +00:00
|
|
|
import React from "react";
|
2020-12-16 07:02:41 +00:00
|
|
|
import { HelpItem } from "../../components/help-enabler/HelpItem";
|
2021-01-26 01:41:14 +00:00
|
|
|
import { UseFormMethods, Controller } from "react-hook-form";
|
2020-12-16 07:02:41 +00:00
|
|
|
import { FormAccess } from "../../components/form-access/FormAccess";
|
2021-01-04 21:33:18 +00:00
|
|
|
import { WizardSectionHeader } from "../../components/wizard-section-header/WizardSectionHeader";
|
2020-10-30 20:15:37 +00:00
|
|
|
|
2021-01-04 21:33:18 +00:00
|
|
|
export type LdapSettingsAdvancedProps = {
|
2021-01-26 01:41:14 +00:00
|
|
|
form: UseFormMethods;
|
2021-01-04 21:33:18 +00:00
|
|
|
showSectionHeading?: boolean;
|
|
|
|
showSectionDescription?: boolean;
|
|
|
|
};
|
|
|
|
|
|
|
|
export const LdapSettingsAdvanced = ({
|
2021-01-26 01:41:14 +00:00
|
|
|
form,
|
2021-01-04 21:33:18 +00:00
|
|
|
showSectionHeading = false,
|
|
|
|
showSectionDescription = false,
|
|
|
|
}: LdapSettingsAdvancedProps) => {
|
2020-10-30 20:15:37 +00:00
|
|
|
const { t } = useTranslation("user-federation");
|
2021-12-14 14:56:36 +00:00
|
|
|
const { t: helpText } = useTranslation("user-federation-help");
|
2020-11-25 14:50:40 +00:00
|
|
|
|
2020-10-30 20:15:37 +00:00
|
|
|
return (
|
|
|
|
<>
|
2021-01-04 21:33:18 +00:00
|
|
|
{showSectionHeading && (
|
|
|
|
<WizardSectionHeader
|
|
|
|
title={t("advancedSettings")}
|
|
|
|
description={helpText("ldapAdvancedSettingsDescription")}
|
|
|
|
showDescription={showSectionDescription}
|
|
|
|
/>
|
|
|
|
)}
|
|
|
|
|
2020-11-25 16:17:50 +00:00
|
|
|
<FormAccess role="manage-realm" isHorizontal>
|
2020-10-30 20:15:37 +00:00
|
|
|
<FormGroup
|
|
|
|
label={t("enableLdapv3Password")}
|
|
|
|
labelIcon={
|
|
|
|
<HelpItem
|
2021-12-14 14:56:36 +00:00
|
|
|
helpText="users-federation-help:enableLdapv3PasswordHelp"
|
|
|
|
fieldLabelId="users-federation:enableLdapv3Password"
|
2020-10-30 20:15:37 +00:00
|
|
|
/>
|
|
|
|
}
|
|
|
|
fieldId="kc-enable-ldapv3-password"
|
|
|
|
hasNoPaddingTop
|
|
|
|
>
|
2020-11-25 14:50:40 +00:00
|
|
|
<Controller
|
2020-12-16 07:02:41 +00:00
|
|
|
name="config.usePasswordModifyExtendedOp"
|
2021-01-26 01:41:14 +00:00
|
|
|
defaultValue={["false"]}
|
|
|
|
control={form.control}
|
2020-11-25 14:50:40 +00:00
|
|
|
render={({ onChange, value }) => (
|
|
|
|
<Switch
|
|
|
|
id={"kc-enable-ldapv3-password"}
|
|
|
|
isDisabled={false}
|
2021-01-26 01:41:14 +00:00
|
|
|
onChange={(value) => onChange([`${value}`])}
|
|
|
|
isChecked={value[0] === "true"}
|
2020-11-25 14:50:40 +00:00
|
|
|
label={t("common:on")}
|
|
|
|
labelOff={t("common:off")}
|
|
|
|
/>
|
|
|
|
)}
|
|
|
|
></Controller>
|
2020-10-30 20:15:37 +00:00
|
|
|
</FormGroup>
|
|
|
|
|
|
|
|
<FormGroup
|
|
|
|
label={t("validatePasswordPolicy")}
|
|
|
|
labelIcon={
|
|
|
|
<HelpItem
|
2021-12-14 14:56:36 +00:00
|
|
|
helpText="users-federation-help:validatePasswordPolicyHelp"
|
|
|
|
fieldLabelId="users-federation:validatePasswordPolicy"
|
2020-10-30 20:15:37 +00:00
|
|
|
/>
|
|
|
|
}
|
|
|
|
fieldId="kc-validate-password-policy"
|
|
|
|
hasNoPaddingTop
|
|
|
|
>
|
2020-11-25 14:50:40 +00:00
|
|
|
<Controller
|
2020-12-16 07:02:41 +00:00
|
|
|
name="config.validatePasswordPolicy"
|
2021-02-19 23:13:07 +00:00
|
|
|
defaultValue={["false"]}
|
2021-01-26 01:41:14 +00:00
|
|
|
control={form.control}
|
2020-11-25 14:50:40 +00:00
|
|
|
render={({ onChange, value }) => (
|
|
|
|
<Switch
|
|
|
|
id={"kc-validate-password-policy"}
|
|
|
|
isDisabled={false}
|
2021-01-26 01:41:14 +00:00
|
|
|
onChange={(value) => onChange([`${value}`])}
|
|
|
|
isChecked={value[0] === "true"}
|
2020-11-25 14:50:40 +00:00
|
|
|
label={t("common:on")}
|
|
|
|
labelOff={t("common:off")}
|
|
|
|
/>
|
|
|
|
)}
|
|
|
|
></Controller>
|
2020-10-30 20:15:37 +00:00
|
|
|
</FormGroup>
|
|
|
|
|
|
|
|
<FormGroup
|
|
|
|
label={t("trustEmail")}
|
|
|
|
labelIcon={
|
|
|
|
<HelpItem
|
2021-12-14 14:56:36 +00:00
|
|
|
helpText="users-federation-help:trustEmailHelp"
|
|
|
|
fieldLabelId="users-federation:trustEmail"
|
2020-10-30 20:15:37 +00:00
|
|
|
/>
|
|
|
|
}
|
|
|
|
fieldId="kc-trust-email"
|
|
|
|
hasNoPaddingTop
|
|
|
|
>
|
2020-11-25 14:50:40 +00:00
|
|
|
<Controller
|
2020-12-16 07:02:41 +00:00
|
|
|
name="config.trustEmail"
|
2021-02-19 23:13:07 +00:00
|
|
|
defaultValue={["false"]}
|
2021-01-26 01:41:14 +00:00
|
|
|
control={form.control}
|
2020-11-25 14:50:40 +00:00
|
|
|
render={({ onChange, value }) => (
|
|
|
|
<Switch
|
|
|
|
id={"kc-trust-email"}
|
|
|
|
isDisabled={false}
|
2021-01-26 01:41:14 +00:00
|
|
|
onChange={(value) => onChange([`${value}`])}
|
|
|
|
isChecked={value[0] === "true"}
|
2020-11-25 14:50:40 +00:00
|
|
|
label={t("common:on")}
|
|
|
|
labelOff={t("common:off")}
|
|
|
|
/>
|
|
|
|
)}
|
|
|
|
></Controller>
|
2020-10-30 20:15:37 +00:00
|
|
|
</FormGroup>
|
2020-11-25 16:17:50 +00:00
|
|
|
</FormAccess>
|
2020-10-30 20:15:37 +00:00
|
|
|
</>
|
|
|
|
);
|
|
|
|
};
|