Commit 174ebf57 authored by okhin's avatar okhin 🚴

CHeck if is array

parent 48fd5420
Pipeline #2265 passed with stages
in 12 seconds
...@@ -108,14 +108,14 @@ class Campaign extends Controller ...@@ -108,14 +108,14 @@ class Campaign extends Controller
$user = $f3->get('container')['user_finder']->findByEmail(\Utils::asl($email)); $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 // We have an existing user, we should try to login with the provided password
// or 403. // or 403.
$mapper = new \DB\SQL\Mapper($f3->get('DB'), 'users'); $mapper = new \DB\SQL\Mapper($f3->get('DB'), 'users');
$auth = new \Auth($mapper, array('id' => 'email', 'pw' => 'hash')); $auth = new \Auth($mapper, array('id' => 'email', 'pw' => 'hash'));
$login = $auth->login($email, $hash); $login = $auth->login($email, $hash);
if (!$login) { if (!$login) {
$f3->error(403); $f3->error(400, "count(user): ". count($user) . "user: $user, email: $email, pass: $hash");
} }
$email = $user['email']; $email = $user['email'];
$user_id = $user['id']; $user_id = $user['id'];
......
...@@ -2,12 +2,14 @@ ...@@ -2,12 +2,14 @@
<div class="row"> <div class="row">
<div class="col-md-10 col-md-offset-1 header"> <div class="col-md-10 col-md-offset-1 header">
<h2><span>{{ @ERROR.code }} - {{ @ERROR.status }}</span></h2> <h2><span>{{ @ERROR.code }} - {{ @ERROR.status }}</span></h2>
<span>{{ @@emsg }}</span>
<hr> <hr>
</div> </div>
</div> </div>
<div class="row"> <div class="row">
<check if="{{ @ERROR.code == 403 }}"> <check if="{{ @ERROR.code == 403 }}">
<div class="col-md-5 col-md-offset-1 well light-blue"> <div class="col-md-5 col-md-offset-1 well light-blue">
<h2><span>{{ @ERROR.code }} - {{ @ERROR.status }}</span></h2>
{{ _("Accès refusé.<br>Votre mot de passe est invalide.") }} {{ _("Accès refusé.<br>Votre mot de passe est invalide.") }}
</div> </div>
<div class="col-md-5 well sky-blue"> <div class="col-md-5 well sky-blue">
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment