Example #1
0
 /**
  * Resets password.
  *
  * @return bool if password was reset
  */
 public function resetPassword()
 {
     if ($this->validate()) {
         $this->_user->setPassword($this->password);
         return $this->_user->save(true, ['passwordHash']);
     }
     return false;
 }
 /**
  * Signs user up.
  *
  * @return User|null the saved model or null if saving fails
  */
 public function signup()
 {
     if ($this->validate()) {
         $user = new UserModel();
         $user->login = $this->login;
         $user->email = $this->email;
         $user->setPassword($this->password);
         $user->generateAuthKey();
         $user->save();
         return $user;
     }
     return null;
 }