import React, { FC } from 'react'; import config from 'app/core/config'; import { Button, LinkButton, Form, Field, Input, HorizontalGroup } from '@grafana/ui'; import { ChangePasswordFields } from 'app/core/utils/UserProvider'; import { css } from 'emotion'; export interface Props { isSaving: boolean; onChangePassword: (payload: ChangePasswordFields) => void; } export const ChangePasswordForm: FC = ({ onChangePassword, isSaving }) => { const { ldapEnabled, authProxyEnabled } = config; if (ldapEnabled || authProxyEnabled) { return

You cannot change password when ldap or auth proxy authentication is enabled.

; } return (
{({ register, errors, getValues }) => { return ( <> v === getValues().confirmNew || 'Passwords must match', old: v => v !== getValues().oldPassword || `New password can't be the same as the old one.`, }, })} /> v === getValues().newPassword || 'Passwords must match', })} /> Cancel ); }}
); };