From 174ebf57da79ebb0e84fb64c504f1fdc3daceeca Mon Sep 17 00:00:00 2001 From: Okhin Date: Tue, 20 Nov 2018 17:13:36 +0100 Subject: [PATCH] CHeck if is array --- app/controller/campaign.php | 4 ++-- app/view/campaign/errors.html | 2 ++ 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/app/controller/campaign.php b/app/controller/campaign.php index 37db577..856f7c9 100644 --- a/app/controller/campaign.php +++ b/app/controller/campaign.php @@ -108,14 +108,14 @@ class Campaign extends Controller $user = $f3->get('container')['user_finder']->findByEmail(\Utils::asl($email)); - if (count($user) > 0) { + if (count($user) > 0 && is_array($user)) { // We have an existing user, we should try to login with the provided password // or 403. $mapper = new \DB\SQL\Mapper($f3->get('DB'), 'users'); $auth = new \Auth($mapper, array('id' => 'email', 'pw' => 'hash')); $login = $auth->login($email, $hash); if (!$login) { - $f3->error(403); + $f3->error(400, "count(user): ". count($user) . "user: $user, email: $email, pass: $hash"); } $email = $user['email']; $user_id = $user['id']; diff --git a/app/view/campaign/errors.html b/app/view/campaign/errors.html index 3f6a50b..cbe0b2d 100644 --- a/app/view/campaign/errors.html +++ b/app/view/campaign/errors.html @@ -2,12 +2,14 @@

{{ @ERROR.code }} - {{ @ERROR.status }}

+ {{ @@emsg }}
+

{{ @ERROR.code }} - {{ @ERROR.status }}

{{ _("Accès refusé.
Votre mot de passe est invalide.") }}
-- GitLab