Hi Mario,
> I want to validate the length of my password using the cakephp model's
> validation. However, since the password is being hashed before it is
> saved on the database, my length validation criteria becomes void. We
> all know that a hashed password contains many characters.
I would make a copy of 'password' before it gets to the Auth
component, and add a rule for that instead. Something like:
function add()
{
if (!empty($this->data))
{
$this->data['User']['password_plain'] =
$this->data['User']['password'];
}
}
var $validate = array(
'username' => array(
'isalphanumeric' => array(
'rule' => array('alphanumeric'),
'required' => true,
'allowEmpty' => false,
'message' => 'Only letters and numbers are allowed.'
),
'unique' => array(
'rule' => array('checkUnique', 'username'),
'message' => 'User name taken. Please use another.'
),
'notempty' => array(
'rule' => array('minLength', '6'),
'required' => true,
'allowEmpty' => false,
'message' => 'Username must have at least 6 characters'
)
),
'password' => array(
'required' => true,
'allowEmpty' => false,
'message' => 'Password can not be empty'
)
'password_plain' => array(
'rule' => array('minLength', '6'),
'required' => true,
'allowEmpty' => false,
'message' => 'Password must have at least 6 characters'
)
}
hth
jon
--
jon bennett
w: http://www.jben.net/
iChat (AIM): jbendotnet Skype: jon-bennett
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"CakePHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---