Check passwords match

This commit is contained in:
Nicolas Meienberger 2022-05-03 22:17:35 +02:00
parent 56759e9ee5
commit 4d7206f889

View file

@ -4,7 +4,7 @@ import { Field, Form } from 'react-final-form';
import validator from 'validator';
import FormInput from '../../../components/Form/FormInput';
type FormValues = { email: string; password: string };
type FormValues = { email: string; password: string; passwordConfirm: string };
interface IProps {
onSubmit: (values: FormValues) => void;
@ -23,6 +23,10 @@ const Onboarding: React.FC<IProps> = ({ onSubmit, loading }) => {
errors.password = 'Required';
}
if (values.password !== values.passwordConfirm) {
errors.passwordConfirm = 'Passwords do not match';
}
return errors;
};
@ -64,7 +68,7 @@ const Onboarding: React.FC<IProps> = ({ onSubmit, loading }) => {
)}
/>
<Field
name="password-repeat"
name="passwordConfirm"
render={({ input, meta }) => (
<FormInput
size="lg"