Be able to disable the login form for specific users

This commit is contained in:
Frederic Guillot
2015-02-07 23:28:17 -05:00
parent 607d9dc794
commit 00b9508d81
25 changed files with 148 additions and 69 deletions

View File

@@ -30,9 +30,14 @@ class Database extends Base
*/
public function authenticate($username, $password)
{
$user = $this->db->table(User::TABLE)->eq('username', $username)->eq('is_ldap_user', 0)->findOne();
$user = $this->db
->table(User::TABLE)
->eq('username', $username)
->eq('disable_login_form', 0)
->eq('is_ldap_user', 0)
->findOne();
if ($user && password_verify($password, $user['password'])) {
if (is_array($user) && password_verify($password, $user['password'])) {
$this->userSession->refresh($user);
$this->container['dispatcher']->dispatch('auth.success', new AuthEvent(self::AUTH_NAME, $user['id']));
return true;