mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
LDAP: Render bind password as a secret input field (#94376)
render bind password as a secret input field
This commit is contained in:
@@ -20,6 +20,7 @@ import {
|
|||||||
TextLink,
|
TextLink,
|
||||||
Dropdown,
|
Dropdown,
|
||||||
MultiSelect,
|
MultiSelect,
|
||||||
|
SecretInput,
|
||||||
} from '@grafana/ui';
|
} from '@grafana/ui';
|
||||||
import { FormPrompt } from 'app/core/components/FormPrompt/FormPrompt';
|
import { FormPrompt } from 'app/core/components/FormPrompt/FormPrompt';
|
||||||
import { Page } from 'app/core/components/Page/Page';
|
import { Page } from 'app/core/components/Page/Page';
|
||||||
@@ -98,6 +99,7 @@ export const LdapSettingsPage = () => {
|
|||||||
const [isLoading, setIsLoading] = useState(true);
|
const [isLoading, setIsLoading] = useState(true);
|
||||||
const [isDrawerOpen, setIsDrawerOpen] = useState(false);
|
const [isDrawerOpen, setIsDrawerOpen] = useState(false);
|
||||||
|
|
||||||
|
const [isBindPasswordConfigured, setBindPasswordConfigured] = useState(false);
|
||||||
const [mapKeyCertConfigured, setMapKeyCertConfigured] = useState<MapKeyCertConfigured>({
|
const [mapKeyCertConfigured, setMapKeyCertConfigured] = useState<MapKeyCertConfigured>({
|
||||||
// values
|
// values
|
||||||
rootCaCertValue: false,
|
rootCaCertValue: false,
|
||||||
@@ -114,6 +116,7 @@ export const LdapSettingsPage = () => {
|
|||||||
control,
|
control,
|
||||||
formState: { isDirty },
|
formState: { isDirty },
|
||||||
getValues,
|
getValues,
|
||||||
|
setValue,
|
||||||
handleSubmit,
|
handleSubmit,
|
||||||
register,
|
register,
|
||||||
reset,
|
reset,
|
||||||
@@ -137,6 +140,7 @@ export const LdapSettingsPage = () => {
|
|||||||
clientCertPath: isOptionDefined(serverConfig.client_cert),
|
clientCertPath: isOptionDefined(serverConfig.client_cert),
|
||||||
clientKeyCertPath: isOptionDefined(serverConfig.client_key),
|
clientKeyCertPath: isOptionDefined(serverConfig.client_key),
|
||||||
});
|
});
|
||||||
|
setBindPasswordConfigured(isOptionDefined(serverConfig.bind_password));
|
||||||
|
|
||||||
reset(payload);
|
reset(payload);
|
||||||
setIsLoading(false);
|
setIsLoading(false);
|
||||||
@@ -325,10 +329,15 @@ export const LdapSettingsPage = () => {
|
|||||||
/>
|
/>
|
||||||
</Field>
|
</Field>
|
||||||
<Field label={t('ldap-settings-page.bind-password.label', 'Bind password')}>
|
<Field label={t('ldap-settings-page.bind-password.label', 'Bind password')}>
|
||||||
<Input
|
<SecretInput
|
||||||
id="bind-password"
|
id="bind-password"
|
||||||
type="text"
|
isConfigured={isBindPasswordConfigured}
|
||||||
{...register(`${serverConfig}.bind_password`, { required: false })}
|
onReset={() => {
|
||||||
|
setValue(`${serverConfig}.bind_password`, '');
|
||||||
|
setBindPasswordConfigured(false);
|
||||||
|
}}
|
||||||
|
value={watch(`${serverConfig}.bind_password`)}
|
||||||
|
onChange={({ currentTarget: { value } }) => setValue(`${serverConfig}.bind_password`, value)}
|
||||||
/>
|
/>
|
||||||
</Field>
|
</Field>
|
||||||
<Field
|
<Field
|
||||||
|
|||||||
Reference in New Issue
Block a user