Solution 1:

function hashPasswords($data) {
                if (isset($data[$this->userModel])) {
                        $model =& $this->getModel();
                        if (!empty($data[$this->userModel][$this-
>fields['username']]) && !empty($data[$this->userModel][$this-
>fields['password']]) && $model->validates()) {
                           $data[$this->userModel][$this->fields['password']] = 
$this-
>password($data[$this->userModel][$this->fields['password']]);
                        }
                }
                return $data;
        }
---------------------------------------------------------------
https://trac.cakephp.org/ticket/3339

The code above is copied from link above, how do we put this in ?
Controller; or User model validation?; Register field ?
----------------------------------------------------------------
There's another Solution 2 which is:

if($this->data['User']['password'] == $this->Auth->password($this-
>data['User']['password2']) && sizeof($this->data['User']
['password2']) >= $minLength)

Link here: http://book.cakephp.org/comments/125

How exactly do we include the "if" statement above, where should it be
in ? Controller; or User model validation?; Register field ?

-------------------------------------------------------------



On Dec 21, 1:13 am, John Maxim <[email protected]> wrote:
> 'password' => array(
>                         'notEmpty' => array(
>                                 'rule' => 'notEmpty',
>                                 'message' => 'This field cannot be blank.',
>                                 'last' => true,
>                         ),
>                         'lengthCheck' => array(
>                                 'rule' => '/^.{6,40}$/',
>                                 'message' => 'Minimum password 6 characters.',
>                                 'last' => true,
>                         ),
>                 ),
>
> **
> The registration validation is affected when hash password is enabled.
> It doesn't matter how the hash was enabled; using Auth component; or
> Md5, once hash is enabled, the password validation no longer can be
> triggered. So, I think something wrong with the above validation ?
>
> The full validations for all fields are below: (Note: only the
> password validation is affected)
>
> 'username' => array(
>                         'notEmpty' => array(
>                                 'rule' => 'notEmpty',
>                                 'message' => 'This field cannot be blank.',
>                                 'last' => true,
>         ),
>             'uniqueCheck' => array(
>                                 'rule' => 'isUnique',
>                                 'message' => 'That username has already been 
> taken.',
>                                 'last' => true,
>         ),
>             'lengthCheck' => array(
>                                 'rule' => '/^.{6,40}$/',
>                                 'message' => 'Minimum username 6 characters.',
>                                 'last' => true,
>         ),
>     ),
>
>                 'email' => array(
>             'notEmpty' => array(
>                   'rule' => 'notEmpty',
>                   'message' => 'This field cannot be blank.',
>                   'last' => true,
>              ),
>             'email' => array(
>                   'rule' => 'email',
>                   'message' => 'That is not a valid email address.',
>                                   'last' => true,
>               ),
>           ),
>
>                 'password' => array(
>                         'notEmpty' => array(
>                                 'rule' => 'notEmpty',
>                                 'message' => 'This field cannot be blank.',
>                                 'last' => true,
>                         ),
>                         'lengthCheck' => array(
>                                 'rule' => '/^.{6,40}$/',
>                                 'message' => 'Minimum password 6 characters.',
>                                 'last' => true,
>                         ),
>                 ),
>
> **
> Is there an alternative way to write these validations?; I have no
> clue why the password validation is nullified when hash password is
> enabled using any way.

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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

Reply via email to