react hook form password strength code example
Example 1: how to validate password and confirm password on react form hook
const validationSchema = yup.object().shape({
newPassword: yup.string()
.required('New Password is required'),
confirmPassword: yup.string()
.required('Confirm Password is required')
.oneOf([yup.ref('password'), null], 'Passwords does not match'),
});
Example 2: react hook form password validation uppercase
function checkPassword(str)
{
var re = /^(?=.*\d)(?=.*[!@#$%^&*])(?=.*[a-z])(?=.*[A-Z]).{8,}$/;
return re.test(str);
}