aboutsummaryrefslogtreecommitdiff
path: root/src/api/utils
diff options
context:
space:
mode:
authorZephyrrus <[email protected]>2020-07-19 22:35:59 +0300
committerZephyrrus <[email protected]>2020-07-19 22:35:59 +0300
commit645b62b81dc46b2e2bdea0fbe30c36c4e0ff4a48 (patch)
tree4c454e816b699ead53d225afadfb528649d126f7 /src/api/utils
parentfeat: Start working on a new album/tags/image info modal (diff)
parentUpdate setup script (diff)
downloadhost.fuwn.me-645b62b81dc46b2e2bdea0fbe30c36c4e0ff4a48.tar.xz
host.fuwn.me-645b62b81dc46b2e2bdea0fbe30c36c4e0ff4a48.zip
Merge branch 'dev' into dev-zephy
Diffstat (limited to 'src/api/utils')
-rw-r--r--src/api/utils/Util.js8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/api/utils/Util.js b/src/api/utils/Util.js
index 905948a..ee4c748 100644
--- a/src/api/utils/Util.js
+++ b/src/api/utils/Util.js
@@ -175,7 +175,13 @@ class Util {
}
}
- static isAuthorized(req) {
+ static async isAuthorized(req) {
+ if (req.headers.token) {
+ const user = await db.table('users').where({ apiKey: req.headers.token }).first();
+ if (!user || !user.enabled) return false;
+ return user;
+ }
+
if (!req.headers.authorization) return false;
const token = req.headers.authorization.split(' ')[1];
if (!token) return false;