Oops, also here's my model
class User extends AppModel {
var $name = 'User';
var $hasMany = 'Campaign';
var $validate = array(
'first_name' => array('notempty' => array('rule' =>
array('notempty'),'message' => 'Please enter your first name')),
'last_name' => array('notempty' => array('rule' =>
array('notempty'),'message' => 'Please enter your last name')),
'email' => array(
'email' => array('rule' => array('email'),'message' =>
'Please
enter your email'),
'unique' => array('rule' => array('checkUnique',
'email'),'message'
=> 'We already have a record of your email address, please login using
it')),
'password' => array(
'notempty' => array('rule' =>
array('notempty'),'message' =>
'Please enter a password'),
'passwordSimilar' => array ('rule' =>
'checkPasswords','message' =>
'your passwords did not match')));
function checkUnique($data, $fieldName) {
$valid = false;
if(isset($fieldName) && $this->hasField($fieldName)) {
$valid = $this->isUnique(array($fieldName => $data));
}
return $valid;
}
function checkPasswords ($data) {
if ($data['password'] ==
$this->data['RegUser']['password2hashed'])
return true;
return false;
}
}
--
Our newest site for the community: CakePHP Video Tutorials
http://tv.cakephp.org
Check out the new CakePHP Questions site http://ask.cakephp.org and help others
with their CakePHP related questions.
To unsubscribe from this group, send email to
[email protected] For more options, visit this group at
http://groups.google.com/group/cake-php