Created
February 11, 2020 17:17
-
-
Save jucemar-dimon/c19f8022f2f8a7b73546b166bfab43dd to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const Schema = Yup.object().shape({ | |
password: Yup.string() | |
.required('Campo senha vazio.') | |
.matches( | |
/^(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[!@#\$%\^&\*])(?=.{8,})/, | |
'Must Contain 8 Characters, One Uppercase, One Lowercase, One Number and One Special Case Character', | |
), | |
changepassword: Yup.string().when('password', { | |
is: val => (val && val.length > 0 ? true : false), | |
then: Yup.string().oneOf( | |
[Yup.ref('password')], | |
'Valor digitado é diferente do anterior.', | |
), | |
}), | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment