修复权限验证问题
This commit is contained in:
parent
78b7dd36c2
commit
39f5cfc1c7
|
|
@ -70,7 +70,7 @@ exports.session = {
|
|||
verify: {
|
||||
// verify options is not required
|
||||
},
|
||||
verifyCallback: (error) => { throw new Error("token verify error"); }, // default verify fail callback
|
||||
verifyCallback: any => any, // default verify fail callback
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -12,8 +12,7 @@ module.exports = class extends Base {
|
|||
}
|
||||
try {
|
||||
let user = await this.session('user');
|
||||
console.log(".......session user", this.ctx.action, Object.keys(user));
|
||||
if (think.isEmpty(user)) {
|
||||
if (think.isEmpty(user.id)) {
|
||||
return this.fail(401, '请先登录');
|
||||
}
|
||||
this.ctx.state.user = user;
|
||||
|
|
@ -57,7 +56,6 @@ module.exports = class extends Base {
|
|||
});
|
||||
data.token = token;
|
||||
this.json({ code: 0, data, msg: "登陆成功" });
|
||||
|
||||
}
|
||||
} catch (error) {
|
||||
this.json({ code: 1, data: '', msg: error.toString() });
|
||||
|
|
|
|||
Loading…
Reference in New Issue