Added id to the auth token

Resolved #1
This commit is contained in:
2021-03-07 06:41:01 +11:00
parent 2e024f71c3
commit aacd64a769
8 changed files with 14 additions and 13 deletions
+1 -1
View File
@@ -4,7 +4,7 @@ const { accounts } = require('../database/models');
const route = async (req, res) => {
const account = await accounts.findOne({
where: {
username: req.user.username
id: req.user.id
}
});
+2 -2
View File
@@ -11,7 +11,7 @@ const { accounts } = require('../database/models');
const route = async (req, res) => {
const account = await accounts.findOne({
where: {
username: req.user.username
id: req.user.id
}
});
@@ -30,7 +30,7 @@ const route = async (req, res) => {
},
{
where: {
username: req.user.username
id: req.user.id
}
});
+1 -1
View File
@@ -43,7 +43,7 @@ const route = async (req, res) => {
});
//generate the JWT
const tokens = generate(account.username, account.privilege);
const tokens = generate(account.id, account.username, account.privilege);
//finally
res.status(200).json(tokens);
+1 -1
View File
@@ -16,7 +16,7 @@ const route = async (req, res) => {
hash: hash
}, {
where: {
username: req.user.username
id: req.user.id
}
});