import { useState } from 'react'; import { Button, Field, LinkButton, Stack } from '@grafana/ui'; import { Form } from 'app/core/components/Form/Form'; import { ValidationLabels, strongPasswordValidations, strongPasswordValidationRegister, } from 'app/core/components/ValidationLabels/ValidationLabels'; import config from 'app/core/config'; import { t, Trans } from 'app/core/internationalization'; import { UserDTO } from 'app/types'; import { PasswordField } from '../../core/components/PasswordField/PasswordField'; import { ChangePasswordFields } from './types'; export interface Props { user: UserDTO; isSaving: boolean; onChangePassword: (payload: ChangePasswordFields) => void; } export const ChangePasswordForm = ({ user, onChangePassword, isSaving }: Props) => { const [displayValidationLabels, setDisplayValidationLabels] = useState(false); const [pristine, setPristine] = useState(true); const { disableLoginForm } = config; const authSource = user.authLabels?.length && user.authLabels[0]; if (authSource === 'LDAP' || authSource === 'Auth Proxy') { return (