Add check for the username at login

This commit is contained in:
Frederic Guillot 2013-07-03 22:05:10 -04:00
parent 849a25dfb0
commit f02e35ac53

View File

@ -484,11 +484,12 @@ function get_config()
} }
function get_user() function get_user($username)
{ {
return \PicoTools\singleton('db') return \PicoTools\singleton('db')
->table('config') ->table('config')
->columns('username', 'password', 'language') ->columns('username', 'password', 'language')
->eq('username', $username)
->findOne(); ->findOne();
} }
@ -506,7 +507,7 @@ function validate_login(array $values)
if ($result) { if ($result) {
$user = get_user(); $user = get_user($values['username']);
if ($user && \password_verify($values['password'], $user['password'])) { if ($user && \password_verify($values['password'], $user['password'])) {