Return to Snippet

Revision: 4945
at January 30, 2008 04:49 by halbtuerke


Initial Code
<?php
 
/**
* Class used for user authentication on the league website
*
*/
 
class User extends AppModel
{
    var $name = 'User';
 
    var $validate = array(
        'id' => array('rule' => 'blank',
                      'on' => 'create'),
        'username' => array('rule' => 'alphanumeric',
                            'required' => true,
                            'message' => 'Please enter a username'),
        'password' => array('rule' => array('confirmPassword', 'password'),
                            'message' => 'Passwords do not match'),
        'password_confirm' => array('rule' => 'alphanumeric',
                                    'required' => true)
    );
 
    function confirmPassword($data, $fieldName) {
        $valid = false;
       
        if ($data['password'] == Security::hash(Configure::read('Security.salt') . $this->data['User']['password_confirm'])) {
            $valid = true;
        }
       
        return $valid;
    }
 
}
?>

Initial URL


Initial Description


Initial Title
User Registration in CakePHP

Initial Tags
php, cakephp, user

Initial Language
PHP