mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-10-29 18:16:17 +01:00
fix: token verify
This commit is contained in:
@@ -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) {
|
||||||
|
|||||||
Reference in New Issue
Block a user