import React from 'react'; import { Controller, useForm } from 'react-hook-form'; import { Trans, useTranslation } from 'react-i18next'; import Controls from './Controls'; import { validatePasswordLength, validateRequiredValue } from '../../helpers/validators'; import { Input } from '../../components/ui/Controls/Input'; type AuthFormValues = { username: string; password: string; confirm_password: string; }; type Props = { onAuthSubmit: (values: AuthFormValues) => void; }; export const Auth = ({ onAuthSubmit }: Props) => { const { t } = useTranslation(); const { handleSubmit, watch, control, formState: { isDirty, isValid }, } = useForm({ mode: 'onChange', defaultValues: { username: '', password: '', confirm_password: '', }, }); const password = watch('password'); const validateConfirmPassword = (value: string) => { if (value !== password) { return t('form_error_password'); } return undefined; }; return (
install_auth_title

install_auth_desc

( )} />
( )} />
( )} />
); };