aboutsummaryrefslogtreecommitdiff
path: root/src/api/routes/user
diff options
context:
space:
mode:
authorZephyrrus <[email protected]>2020-07-10 01:17:00 +0300
committerGitHub <[email protected]>2020-07-10 01:17:00 +0300
commita721681944e9eb06742e5b3f71c71aed9c1c117d (patch)
tree93ff9fd13a0434d91fb1ae7ca0da48d6929c4d00 /src/api/routes/user
parentfeat: backend pagination for albums (diff)
parentrefactor: finish refactoring all the components to use vuex (diff)
downloadhost.fuwn.me-a721681944e9eb06742e5b3f71c71aed9c1c117d.tar.xz
host.fuwn.me-a721681944e9eb06742e5b3f71c71aed9c1c117d.zip
Merge pull request #1 from Zephyrrus/feature/store_refactor
Feature/store refactor
Diffstat (limited to 'src/api/routes/user')
-rw-r--r--src/api/routes/user/apiKey.js6
-rw-r--r--src/api/routes/user/changePasswordPOST.js6
-rw-r--r--src/api/routes/user/userGET.js5
3 files changed, 9 insertions, 8 deletions
diff --git a/src/api/routes/user/apiKey.js b/src/api/routes/user/apiKey.js
index a87d98d..a63f0c0 100644
--- a/src/api/routes/user/apiKey.js
+++ b/src/api/routes/user/apiKey.js
@@ -1,7 +1,7 @@
-const Route = require('../../structures/Route');
const randomstring = require('randomstring');
const moment = require('moment');
const { dump } = require('dumper.js');
+const Route = require('../../structures/Route');
class apiKeyPOST extends Route {
constructor() {
@@ -17,7 +17,7 @@ class apiKeyPOST extends Route {
.where({ id: user.id })
.update({
apiKey,
- apiKeyEditedAt: now
+ apiKeyEditedAt: now,
});
} catch (error) {
dump(error);
@@ -26,7 +26,7 @@ class apiKeyPOST extends Route {
return res.json({
message: 'Successfully created new api key',
- apiKey
+ apiKey,
});
}
}
diff --git a/src/api/routes/user/changePasswordPOST.js b/src/api/routes/user/changePasswordPOST.js
index 9cd621e..1b3a27a 100644
--- a/src/api/routes/user/changePasswordPOST.js
+++ b/src/api/routes/user/changePasswordPOST.js
@@ -1,7 +1,7 @@
-const Route = require('../../structures/Route');
-const log = require('../../utils/Log');
const bcrypt = require('bcrypt');
const moment = require('moment');
+const Route = require('../../structures/Route');
+const log = require('../../utils/Log');
class changePasswordPOST extends Route {
constructor() {
@@ -36,7 +36,7 @@ class changePasswordPOST extends Route {
const now = moment.utc().toDate();
await db.table('users').where('id', user.id).update({
password: hash,
- passwordEditedAt: now
+ passwordEditedAt: now,
});
return res.json({ message: 'The password was changed successfully' });
diff --git a/src/api/routes/user/userGET.js b/src/api/routes/user/userGET.js
index fe46fd4..6f179a9 100644
--- a/src/api/routes/user/userGET.js
+++ b/src/api/routes/user/userGET.js
@@ -11,8 +11,9 @@ class usersGET extends Route {
user: {
id: user.id,
username: user.username,
- isAdmin: user.isAdmin
- }
+ isAdmin: user.isAdmin,
+ apiKey: user.apiKey,
+ },
});
}
}