Render the page with the status of the user can't log in.
This commit is contained in:
parent
7c50e03381
commit
f40be66381
@ -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
|
||||||
|
@ -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");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user