1password: yup
2 .string()
3 .required('Please Enter your password')
4 .matches(
5 /^(?=.*[A-Za-z])(?=.*\d)(?=.*[@$!%*#?&])[A-Za-z\d@$!%*#?&]{8,}$/,
6 "Must Contain 8 Characters, One Uppercase, One Lowercase, One Number and one special case Character"
7 ),
8
1import * as Yup from 'yup';
2
3validationSchema: Yup.object({
4 password: Yup.string().required('Password is required'),
5 passwordConfirmation: Yup.string()
6 .oneOf([Yup.ref('password'), null], 'Passwords must match')
7});
8
1passwordConfirm: Yup.string()
2+ .label('Password Confirm')
3+ .required()
4+ .oneOf([Yup.ref('password')], 'Passwords does not match'),
1Yup.object({
2 password: Yup.string().required('Password is required'),
3 passwordConfirmation: Yup.string()
4 .test('passwords-match', 'Passwords must match', function(value){
5 return this.parent.password === value
6 })
7})
8