Fix authorization

This commit is contained in:
Pitu 2020-07-18 02:57:24 +09:00
parent 4dafc79cb7
commit 5f58431409
1 changed files with 1 additions and 3 deletions

View File

@ -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;
}