we have tried several solution for validation of password,but none is working but user get login, all validations get working except alphanumeric validation in password.
Here is code:
'password' => array ('required' => array (
'rule' => array ('notEmpty'),
'rule' => array ('between',1,15 ),
//'rule' => array('custom', '[a-zA-Z0-9, ]+'),
'message' => 'A password is required,must be between 8 to 15 characters' )
),
using custom function it doesn't work so we tried
'alphaNumeric' => array(
'rule' => array('alphaNumericDashUnderscore'),
'rule' => 'alphaNumeric',
'required' => true,
'message' => 'password must contain Alphabets and numbers only'
)),
custom function in model
public function alphaNumericDashUnderscore($check) {
$value = array_values($check);
$value = $value[0];
return preg_match('|^[0-9a-zA-Z_-]*$|', $value);
}
we are working on cakephp version 2.4.3