Merge pull request #971 from SiIky/fix/D0FE5j3T/password-confirmation

fix: password confirmation step
This commit is contained in:
Rafael Taranto 2021-12-07 16:54:56 +00:00 committed by GitHub
commit 3de2bb3d86

View file

@ -42,18 +42,17 @@ const REGISTER = gql`
} }
` `
const validationSchema = Yup.object().shape({ const PASSWORD_MIN_LENGTH = 8
const validationSchema = Yup.object({
password: Yup.string() password: Yup.string()
.required('A password is required') .required('A password is required')
.test( .min(
'len', PASSWORD_MIN_LENGTH,
'Your password must contain more than 8 characters', `Your password must contain at least ${PASSWORD_MIN_LENGTH} characters`
val => val.length >= 8
), ),
confirmPassword: Yup.string().oneOf( confirmPassword: Yup.string()
[Yup.ref('password'), null], .required('Please confirm the password')
'Passwords must match' .oneOf([Yup.ref('password')], 'Passwords must match')
)
}) })
const initialValues = { const initialValues = {