Render the page with the status of the user can't log in.

This commit is contained in:
Dave Smith-Hayes 2024-11-07 22:56:26 -05:00
parent 7c50e03381
commit f40be66381
2 changed files with 3 additions and 3 deletions

View File

@ -25,12 +25,12 @@ class LoginUserAction extends Controller
$user = $this->userRepository->getFromEmail($credentials['email']); $user = $this->userRepository->getFromEmail($credentials['email']);
} catch (EntityNotFoundException $e) { } catch (EntityNotFoundException $e) {
$this->session->getFlash()->add('error', "Unable to login user."); $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())) { if (!$this->auth->verify($credentials['password'], $user->getPassword())) {
$this->session->getFlash()->add('error', "Unable to login."); $this->session->getFlash()->add('error', "Unable to login.");
return $this->response->withStatus(400); return $this->render('user/login.twig')->withStatus(400);
} }
// start the session // start the session

View File

@ -58,7 +58,7 @@ class UserRepository implements UserRepositoryInterface
$statement->execute([ ':email' => $email ]); $statement->execute([ ':email' => $email ]);
$results = $statement->fetch(\PDO::FETCH_ASSOC); $results = $statement->fetch(\PDO::FETCH_ASSOC);
if (!count($results)) { if (!is_array($results) || count($results)) {
throw new EntityNotFoundException("Unable to find User"); throw new EntityNotFoundException("Unable to find User");
} }