aboutsummaryrefslogtreecommitdiff
path: root/src/api/routes/user/apiKey.js
diff options
context:
space:
mode:
authorPitu <[email protected]>2020-05-11 00:57:56 +0900
committerPitu <[email protected]>2020-05-11 00:57:56 +0900
commit496477ebda3f6c347a9944e22daae447d15ebc31 (patch)
treec9449d39ec3f15a3a69a790fbe4c6fce60811b1d /src/api/routes/user/apiKey.js
parentchore: cleanup and todo (diff)
downloadhost.fuwn.me-496477ebda3f6c347a9944e22daae447d15ebc31.tar.xz
host.fuwn.me-496477ebda3f6c347a9944e22daae447d15ebc31.zip
Feature: enable apiKey access to uploads and album fetching for the uploader/sharex/3rd party
Diffstat (limited to 'src/api/routes/user/apiKey.js')
-rw-r--r--src/api/routes/user/apiKey.js6
1 files changed, 2 insertions, 4 deletions
diff --git a/src/api/routes/user/apiKey.js b/src/api/routes/user/apiKey.js
index f80d563..a87d98d 100644
--- a/src/api/routes/user/apiKey.js
+++ b/src/api/routes/user/apiKey.js
@@ -1,12 +1,11 @@
const Route = require('../../structures/Route');
const randomstring = require('randomstring');
const moment = require('moment');
-const bcrypt = require('bcrypt');
const { dump } = require('dumper.js');
class apiKeyPOST extends Route {
constructor() {
- super('/user/apikey/change', 'post', { noApiKey: true });
+ super('/user/apikey/change', 'post');
}
async run(req, res, db, user) {
@@ -14,11 +13,10 @@ class apiKeyPOST extends Route {
const apiKey = randomstring.generate(64);
try {
- const hash = await bcrypt.hash(apiKey, 10);
await db.table('users')
.where({ id: user.id })
.update({
- apiKey: hash,
+ apiKey,
apiKeyEditedAt: now
});
} catch (error) {