Bug correction with recent load method refactor
This commit is contained in:
parent
73b772aa61
commit
17871b984c
1
TODO
1
TODO
@ -14,6 +14,7 @@ Manage paybacks :
|
|||||||
TODO :
|
TODO :
|
||||||
======
|
======
|
||||||
* Add / Edit a bill
|
* Add / Edit a bill
|
||||||
|
* Bug in connection form
|
||||||
|
|
||||||
Tests :
|
Tests :
|
||||||
=======
|
=======
|
||||||
|
@ -135,7 +135,7 @@ class Storage {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if($first_only)
|
if($first_only)
|
||||||
return $return[0];
|
return $return[$result['id']];
|
||||||
else
|
else
|
||||||
return $return;
|
return $return;
|
||||||
}
|
}
|
||||||
|
@ -70,14 +70,10 @@ class User extends Storage {
|
|||||||
// Check if a user exists by login and load it
|
// Check if a user exists by login and load it
|
||||||
// ===========================================
|
// ===========================================
|
||||||
public function exists() {
|
public function exists() {
|
||||||
$user_data = $this->load(array('login'=>$this->login));
|
$user_data = $this->load(array('login'=>$this->login), true);
|
||||||
if(count($user_data) == 1) {
|
|
||||||
$this->setId($user_data[0]['id']);
|
|
||||||
$this->setDisplayName($user_data[0]['display_name']);
|
|
||||||
$this->setAdmin($user_data[0]['admin']);
|
|
||||||
$this->setPassword($user_data[0]['password']);
|
|
||||||
|
|
||||||
return true;
|
if(count($user_data) == 1) {
|
||||||
|
return $user_data;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
return false;
|
return false;
|
||||||
|
@ -77,7 +77,8 @@
|
|||||||
$error = "Unknown username / password.";
|
$error = "Unknown username / password.";
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if($user->exists($_POST['login']) && $user->checkPassword($_POST['password'])) {
|
$user = $user->exists($_POST['login']);
|
||||||
|
if($user !== false && $user->checkPassword($_POST['password'])) {
|
||||||
ban_loginOk();
|
ban_loginOk();
|
||||||
$_SESSION['current_user'] = $user->sessionStore();
|
$_SESSION['current_user'] = $user->sessionStore();
|
||||||
$_SESSION['ip'] = user_ip();
|
$_SESSION['ip'] = user_ip();
|
||||||
|
Loading…
Reference in New Issue
Block a user