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:
parent
6190499f03
commit
501f1bc7a9
@ -20,6 +20,7 @@ import {
|
||||
TextLink,
|
||||
Dropdown,
|
||||
MultiSelect,
|
||||
SecretInput,
|
||||
} from '@grafana/ui';
|
||||
import { FormPrompt } from 'app/core/components/FormPrompt/FormPrompt';
|
||||
import { Page } from 'app/core/components/Page/Page';
|
||||
@ -98,6 +99,7 @@ export const LdapSettingsPage = () => {
|
||||
const [isLoading, setIsLoading] = useState(true);
|
||||
const [isDrawerOpen, setIsDrawerOpen] = useState(false);
|
||||
|
||||
const [isBindPasswordConfigured, setBindPasswordConfigured] = useState(false);
|
||||
const [mapKeyCertConfigured, setMapKeyCertConfigured] = useState<MapKeyCertConfigured>({
|
||||
// values
|
||||
rootCaCertValue: false,
|
||||
@ -114,6 +116,7 @@ export const LdapSettingsPage = () => {
|
||||
control,
|
||||
formState: { isDirty },
|
||||
getValues,
|
||||
setValue,
|
||||
handleSubmit,
|
||||
register,
|
||||
reset,
|
||||
@ -137,6 +140,7 @@ export const LdapSettingsPage = () => {
|
||||
clientCertPath: isOptionDefined(serverConfig.client_cert),
|
||||
clientKeyCertPath: isOptionDefined(serverConfig.client_key),
|
||||
});
|
||||
setBindPasswordConfigured(isOptionDefined(serverConfig.bind_password));
|
||||
|
||||
reset(payload);
|
||||
setIsLoading(false);
|
||||
@ -325,10 +329,15 @@ export const LdapSettingsPage = () => {
|
||||
/>
|
||||
</Field>
|
||||
<Field label={t('ldap-settings-page.bind-password.label', 'Bind password')}>
|
||||
<Input
|
||||
<SecretInput
|
||||
id="bind-password"
|
||||
type="text"
|
||||
{...register(`${serverConfig}.bind_password`, { required: false })}
|
||||
isConfigured={isBindPasswordConfigured}
|
||||
onReset={() => {
|
||||
setValue(`${serverConfig}.bind_password`, '');
|
||||
setBindPasswordConfigured(false);
|
||||
}}
|
||||
value={watch(`${serverConfig}.bind_password`)}
|
||||
onChange={({ currentTarget: { value } }) => setValue(`${serverConfig}.bind_password`, value)}
|
||||
/>
|
||||
</Field>
|
||||
<Field
|
||||
|
Loading…
Reference in New Issue
Block a user