/** * Constructor * */ public function __construct() { parent::__construct(); foreach ($this->records as &$record) { $record['password'] = BcryptFormAuthenticate::hash($record['password'], null, true); } }
/** * Changes the password for a user * * @param array $postData Post data from controller * @return boolean True on success */ public function changePassword($postData = array()) { $this->validate = $this->validatePasswordChange; $this->set($postData); if ($this->validates()) { $this->data[$this->alias]['password'] = BcryptFormAuthenticate::hash($this->data[$this->alias]['new_password']); $this->save($postData, array('validate' => false, 'callbacks' => false)); return true; } return false; }