knicola / yup-password

Yup, dead simple password validation.
MIT License
48 stars 6 forks source link

Cannot read property 'match' of undefined #2

Closed albertcito closed 3 years ago

albertcito commented 3 years ago

I'm getting this error when I write in the current password input, and the others are empty.

This is my schema:

const schema = Yup.object().shape({
      old_password: Yup.string().required(),
      password: Yup.string().min(8)
        .minLowercase(1)
        .minUppercase(1)
        .minNumber(1)
        .required(),
      password_confirmation: Yup.string().oneOf([
        Yup.ref('password')], 'Passwords must match'),
    });
Screen Shot 2021-01-15 at 1 41 23 PM Screen Shot 2021-01-15 at 1 42 37 PM
knicola commented 3 years ago

thank you for reporting this. I've pushed out a new version. undefined values will now be considered valid and can be caught by using required().