diff --git a/new-lamassu-admin/src/pages/Authentication/Register.js b/new-lamassu-admin/src/pages/Authentication/Register.js index 92dab513..a2d54c92 100644 --- a/new-lamassu-admin/src/pages/Authentication/Register.js +++ b/new-lamassu-admin/src/pages/Authentication/Register.js @@ -42,18 +42,17 @@ const REGISTER = gql` } ` -const validationSchema = Yup.object().shape({ +const PASSWORD_MIN_LENGTH = 8 +const validationSchema = Yup.object({ password: Yup.string() .required('A password is required') - .test( - 'len', - 'Your password must contain more than 8 characters', - val => val.length >= 8 + .min( + PASSWORD_MIN_LENGTH, + `Your password must contain at least ${PASSWORD_MIN_LENGTH} characters` ), - confirmPassword: Yup.string().oneOf( - [Yup.ref('password'), null], - 'Passwords must match' - ) + confirmPassword: Yup.string() + .required('Please confirm the password') + .oneOf([Yup.ref('password')], 'Passwords must match') }) const initialValues = {