The last post on that thread, suggesting using beforeValidate, seemed
to work well for me. I've included using beforeSave as well for
hashing the password, such as:
function beforeValidate()
{
if (!isset($this->data[$this->name]['id'])) {
$user =
$this->findByUsername($this->data[$this->name]['username']);
if (!empty($user['User']['username'])) {
$this->invalidate('username_taken');
}
if (strlen($this->data[$this->name]['username']) < 4 ||
!preg_match('/^([a-z]+)$/i', $this->data[$this->name]['username'])) {
$this->invalidate('username_format');
}
if (strlen($this->data[$this->name]['password']) < 6) {
$this->invalidate('password');
}
if ($this->data[$this->name]['password'] !=
$this->data[$this->name]['password2']) {
$this->invalidate('password2');
}
}
return true;
}
function beforeSave()
{
$this->data['User']['password'] =
md5($this->data['User']['password']);
return true;
}
Still not sure why the automatic 'created' field is not being
populated. Anyone got an idea on that?
Andy
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake
PHP" 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
-~----------~----~----~----~------~----~------~--~---