summaryrefslogtreecommitdiff
path: root/app/Model
diff options
context:
space:
mode:
authorFrédéric Guillot <fred@kanboard.net>2019-02-01 15:40:35 -0800
committerFrédéric Guillot <fred@kanboard.net>2019-02-01 15:40:35 -0800
commit233fd1a8a1e4da808ce34f91194a423522e5c478 (patch)
tree87f4f2be0c3bda9f958755bcfc9a71037113cb57 /app/Model
parentfa08493348f54fae3eed64f8de4eb5893000a918 (diff)
Authorize only API tokens when 2FA is enabled
Diffstat (limited to 'app/Model')
-rw-r--r--app/Model/UserModel.php9
1 files changed, 9 insertions, 0 deletions
diff --git a/app/Model/UserModel.php b/app/Model/UserModel.php
index d8db3270..32d0c888 100644
--- a/app/Model/UserModel.php
+++ b/app/Model/UserModel.php
@@ -38,6 +38,15 @@ class UserModel extends Base
->exists();
}
+ public function has2FA($username)
+ {
+ return $this->db->table(self::TABLE)
+ ->eq('username', $username)
+ ->eq('is_active', 1)
+ ->eq('twofactor_activated', 1)
+ ->exists();
+ }
+
/**
* Return true if the user exists
*