Skip to content

Commit

Permalink
fix: token verify
Browse files Browse the repository at this point in the history
  • Loading branch information
barisusakli committed Oct 25, 2021
1 parent 1783f91 commit 04dab1d
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions src/routes/authentication.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,13 +44,9 @@ Auth.getLoginStrategies = function () {
};

Auth.verifyToken = async function (token, done) {
let { tokens = [] } = await meta.settings.get('core.api');
tokens = tokens.reduce((memo, cur) => {
memo[cur.token] = cur.uid;
return memo;
}, {});

const uid = tokens[token];
const { tokens = [] } = await meta.settings.get('core.api');
const tokenObj = tokens.find(t => t.token === token);
const uid = tokenObj ? tokenObj.uid : undefined;

if (uid !== undefined) {
if (parseInt(uid, 10) > 0) {
Expand Down

0 comments on commit 04dab1d

Please sign in to comment.