示例#1
0
 public function tryLoginUser(UserCredentials $toLogin)
 {
     $registered = $this->userDAL->getUserByName($toLogin->getUsername());
     $tempPassword = $this->tempDAL->getTempPassword($toLogin->getUsername());
     $loginByPostCredentials = password_verify($toLogin->getPassword(), $registered->getPassword());
     $loginByCookies = $tempPassword != "" && $tempPassword === $toLogin->getCookiePassword();
     if (!$loginByPostCredentials && !$loginByCookies) {
         throw new \WrongCredentialsException("Wrong credentials");
     }
     $this->loginUser($toLogin);
 }
示例#2
0
 /**
  * Registrates the current user in the database table
  * @param active user name
  * @return boolean
  */
 public function registerName(UserCredentials $userCredentials)
 {
     $name = $userCredentials->getUsername();
     $password = $userCredentials->getPassword();
     $this->dal->insertUser($name, $password);
     return true;
 }
 private function saveUser(UserCredentials $credentials)
 {
     $this->DAL->saveUserCredentials($credentials->getUsername(), $credentials->getPassword());
 }