diff options
| author | Pitu <[email protected]> | 2019-03-29 00:44:33 +0900 |
|---|---|---|
| committer | Pitu <[email protected]> | 2019-03-29 00:44:33 +0900 |
| commit | 0f4d196c8c67e1cdf4296ed678a6155cf369406d (patch) | |
| tree | 44ca44d6615335c5cda7934f1d968775e6bb087b /src/api | |
| parent | WIP apiKey validation (diff) | |
| parent | Merge pull request #190 from robflop/patch-2 (diff) | |
| download | host.fuwn.me-0f4d196c8c67e1cdf4296ed678a6155cf369406d.tar.xz host.fuwn.me-0f4d196c8c67e1cdf4296ed678a6155cf369406d.zip | |
Fix conflicts
Diffstat (limited to 'src/api')
| -rw-r--r-- | src/api/database/seeds/initial.js | 2 | ||||
| -rw-r--r-- | src/api/routes/auth/registerPOST.js | 3 | ||||
| -rw-r--r-- | src/api/structures/Route.js | 2 |
3 files changed, 1 insertions, 6 deletions
diff --git a/src/api/database/seeds/initial.js b/src/api/database/seeds/initial.js index 0ea7bb4..bb8b915 100644 --- a/src/api/database/seeds/initial.js +++ b/src/api/database/seeds/initial.js @@ -11,9 +11,7 @@ exports.seed = async db => { await db.table('users').insert({ username: process.env.ADMIN_ACCOUNT, password: hash, - apiKey: randomstring.generate(64), passwordEditedAt: now, - apiKeyEditedAt: now, createdAt: now, editedAt: now, enabled: true, diff --git a/src/api/routes/auth/registerPOST.js b/src/api/routes/auth/registerPOST.js index 0bd8cfd..feeb360 100644 --- a/src/api/routes/auth/registerPOST.js +++ b/src/api/routes/auth/registerPOST.js @@ -1,7 +1,6 @@ const Route = require('../../structures/Route'); const log = require('../../utils/Log'); const bcrypt = require('bcrypt'); -const randomstring = require('randomstring'); const moment = require('moment'); class registerPOST extends Route { @@ -48,8 +47,6 @@ class registerPOST extends Route { username, password: hash, passwordEditedAt: now, - apiKey: randomstring.generate(64), - apiKeyEditedAt: now, createdAt: now, editedAt: now, enabled: true, diff --git a/src/api/structures/Route.js b/src/api/structures/Route.js index ecb2be0..8a73454 100644 --- a/src/api/structures/Route.js +++ b/src/api/structures/Route.js @@ -28,8 +28,8 @@ class Route { authorize(req, res) { if (this.options.bypassAuth) return this.run(req, res, db); if (req.headers.apiKey) return this.authorizeApiKey(req, res, req.headers.apiKey); - if (!req.headers.authorization) return res.status(401).json({ message: 'No authorization header provided' }); + const token = req.headers.authorization.split(' ')[1]; if (!token) return res.status(401).json({ message: 'No authorization header provided' }); |