cakephp-3-acl-example icon indicating copy to clipboard operation
cakephp-3-acl-example copied to clipboard

Password Hashing Step

Open temp1029 opened this issue 8 years ago • 0 comments

In order to be able to update other user information without changing (or at least re-entering) a users password, I would suggest using the following in App\Model\Entity\User.php

protected function _setPassword($password)
{
     return (new DefaultPasswordHasher)->hash($password);
}

And change the "baked" line below in App\Model\Table\UsersTable.php:

->notEmpty('password');

to this:

->notEmpty('password', 'You must provide a password', 'create');

I would also note that someone should add 'value' => '' anytime they use the Form helper to generate a field for updating the password.

Hope this is helpful.

temp1029 avatar Sep 23 '16 03:09 temp1029