This plugin simply adds an input box for <input type=”password”>. This plugin simply adds an input box for <input type=”password”>. In other words, the characters you enter are hidden, but it accepts any input.
If you add the validation check in the item of Contact Form 7, please add the following code to “functions.php” in the theme folder.
ex.
1. limit the number of characters to at least 10.
2. include one or more numbers, upper and lower case letters, mark.
function wpcf7_validate_password($result,$tag){
$tag = new WPCF7_Shortcode($tag);
$name = $tag->name;
$value = isset($_POST[$name]) ? trim(wp_unslash(strtr((string) $_POST[$name], "\n", " "))) : "";
if(strlen($value) < 10){
$result->invalidate($tag, "Please limit the number of characters to at least 10.");
}else{
if(!
(preg_match("/([a-z].*[A-Z])|([A-Z].*[a-z])/", $value) &&
preg_match("/([0-9])/", $value) &&
preg_match("/([!,%,&,@,#,$,^,*,?,_,~])/", $value))
){
$result->invalidate($tag, "Please include one or more numbers, upper and lower case letters, mark.");
}
}
return $result;
}
add_filter('wpcf7_validate_password', 'wpcf7_validate_password', 11, 2);
add_filter('wpcf7_validate_password*', 'wpcf7_validate_password', 11, 2);