aboutsummaryrefslogtreecommitdiff
path: root/src/api/utils/Util.js
diff options
context:
space:
mode:
authorPitu <[email protected]>2020-07-18 02:57:24 +0900
committerPitu <[email protected]>2020-07-18 02:57:24 +0900
commit5f58431409e1a4e875cd8121cfe9dc47cfecc65e (patch)
treedb311c19439699946f254154a5bd5929df047bf5 /src/api/utils/Util.js
parentfix authorization (diff)
downloadhost.fuwn.me-5f58431409e1a4e875cd8121cfe9dc47cfecc65e.tar.xz
host.fuwn.me-5f58431409e1a4e875cd8121cfe9dc47cfecc65e.zip
Fix authorization
Diffstat (limited to 'src/api/utils/Util.js')
-rw-r--r--src/api/utils/Util.js4
1 files changed, 1 insertions, 3 deletions
diff --git a/src/api/utils/Util.js b/src/api/utils/Util.js
index 80bffd5..7f6dd22 100644
--- a/src/api/utils/Util.js
+++ b/src/api/utils/Util.js
@@ -208,10 +208,8 @@ class Util {
static async isAuthorized(req) {
if (req.headers.token) {
- if (!this.options.canApiKey) return false;
const user = await db.table('users').where({ apiKey: req.headers.token }).first();
- if (!user) return false;
- if (!user.enabled) return false;
+ if (!user || !user.enabled) return false;
return true;
}