Permalink
Browse files

Merge pull request #1142 from ojtibi/patch-1

Improved 'Hashing passwords' example.
  • Loading branch information...
2 parents e908b04 + bd1f6e1 commit 4aa5f8f6e9dd1873e887c2456ad0de7270c19562 @lorenzo lorenzo committed Mar 10, 2014
Showing with 1 addition and 1 deletion.
  1. +1 −1 en/core-libraries/components/authentication.rst
@@ -373,7 +373,7 @@ callback of your model using appropriate password hasher class::
class User extends AppModel {
public function beforeSave($options = array()) {
- if (!$this->id) {
+ if (!empty($this->data['User']['password'])) {
$passwordHasher = new SimplePasswordHasher();
$this->data['User']['password'] = $passwordHasher->hash(
$this->data['User']['password']

0 comments on commit 4aa5f8f

Please sign in to comment.