Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Merge pull request #1142 from ojtibi/patch-1

Improved 'Hashing passwords' example.
  • Loading branch information...
commit 4aa5f8f6e9dd1873e887c2456ad0de7270c19562 2 parents e908b04 + bd1f6e1
@lorenzo lorenzo authored
Showing with 1 addition and 1 deletion.
  1. +1 −1  en/core-libraries/components/authentication.rst
View
2  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']
Please sign in to comment.
Something went wrong with that request. Please try again.