diff --git a/TODO b/TODO index e24475f..88f1b47 100755 --- a/TODO +++ b/TODO @@ -14,6 +14,7 @@ Manage paybacks : TODO : ====== * Add / Edit a bill +* Bug in connection form Tests : ======= diff --git a/inc/Storage.class.php b/inc/Storage.class.php index a82e103..c9b5bd7 100644 --- a/inc/Storage.class.php +++ b/inc/Storage.class.php @@ -135,7 +135,7 @@ class Storage { } if($first_only) - return $return[0]; + return $return[$result['id']]; else return $return; } diff --git a/inc/User.class.php b/inc/User.class.php index 361d373..4a94ecd 100644 --- a/inc/User.class.php +++ b/inc/User.class.php @@ -70,14 +70,10 @@ class User extends Storage { // Check if a user exists by login and load it // =========================================== public function exists() { - $user_data = $this->load(array('login'=>$this->login)); - 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']); + $user_data = $this->load(array('login'=>$this->login), true); - return true; + if(count($user_data) == 1) { + return $user_data; } else { return false; diff --git a/index.php b/index.php index d3b2556..e039b0f 100644 --- a/index.php +++ b/index.php @@ -77,7 +77,8 @@ $error = "Unknown username / password."; } else { - if($user->exists($_POST['login']) && $user->checkPassword($_POST['password'])) { + $user = $user->exists($_POST['login']); + if($user !== false && $user->checkPassword($_POST['password'])) { ban_loginOk(); $_SESSION['current_user'] = $user->sessionStore(); $_SESSION['ip'] = user_ip();