add hashing of passwords on user save

This commit is contained in:
Isaac Connor 2021-04-23 09:07:50 -04:00
parent e01533af7f
commit 15a769bcd1
1 changed files with 7 additions and 0 deletions

View File

@ -34,6 +34,13 @@ class User extends AppModel {
return parent::beforeFind($query);
}
public function beforeSave($options = array()) {
if (!empty($this->data['Password'])) {
$this->data['Password'] = password_hash($this->data['Password'], PASSWORD_BCRYPT);
}
return true;
} # end function beforeSave
/**
* Use table