fix: token verify

This commit is contained in:
Barış Soner Uşaklı
2021-10-25 13:23:54 -04:00
parent 1783f918bc
commit 04dab1d550

View File

@@ -44,13 +44,9 @@ Auth.getLoginStrategies = function () {
}; };
Auth.verifyToken = async function (token, done) { Auth.verifyToken = async function (token, done) {
let { tokens = [] } = await meta.settings.get('core.api'); const { tokens = [] } = await meta.settings.get('core.api');
tokens = tokens.reduce((memo, cur) => { const tokenObj = tokens.find(t => t.token === token);
memo[cur.token] = cur.uid; const uid = tokenObj ? tokenObj.uid : undefined;
return memo;
}, {});
const uid = tokens[token];
if (uid !== undefined) { if (uid !== undefined) {
if (parseInt(uid, 10) > 0) { if (parseInt(uid, 10) > 0) {