diff --git a/app/src/Controller/User/LoginUserAction.php b/app/src/Controller/User/LoginUserAction.php index b721200..81b58a6 100644 --- a/app/src/Controller/User/LoginUserAction.php +++ b/app/src/Controller/User/LoginUserAction.php @@ -25,12 +25,12 @@ class LoginUserAction extends Controller $user = $this->userRepository->getFromEmail($credentials['email']); } catch (EntityNotFoundException $e) { $this->session->getFlash()->add('error', "Unable to login user."); - return $this->response->withStatus(400); + return $this->render('user/login.twig')->withStatus(400); } if (!$this->auth->verify($credentials['password'], $user->getPassword())) { $this->session->getFlash()->add('error', "Unable to login."); - return $this->response->withStatus(400); + return $this->render('user/login.twig')->withStatus(400); } // start the session diff --git a/app/src/Domain/Repository/User/UserRepository.php b/app/src/Domain/Repository/User/UserRepository.php index c2aff85..3310c49 100644 --- a/app/src/Domain/Repository/User/UserRepository.php +++ b/app/src/Domain/Repository/User/UserRepository.php @@ -58,7 +58,7 @@ class UserRepository implements UserRepositoryInterface $statement->execute([ ':email' => $email ]); $results = $statement->fetch(\PDO::FETCH_ASSOC); - if (!count($results)) { + if (!is_array($results) || count($results)) { throw new EntityNotFoundException("Unable to find User"); }