Beispiel #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);
 }