Example #1
0
 /**
  * @param string $newPassword
  * @return bool
  */
 public function changePassword()
 {
     if ($this->getIsNewRecord() == true) {
         throw new \RuntimeException('Calling "' . __CLASS__ . '::' . __METHOD__ . '" on existing user');
     }
     $this->trigger(User::EVENT_PASSWORD_CHANGE);
     $this->password_hash = PasswordHelper::hash($this->password);
     return $this->save();
 }