Check passwords match
This commit is contained in:
parent
56759e9ee5
commit
4d7206f889
1 changed files with 6 additions and 2 deletions
|
@ -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"
|
||||
|
|
Loading…
Add table
Reference in a new issue