修改接口的验证方式
This commit is contained in:
parent
2099384e46
commit
be30ef7e3e
@ -30,8 +30,7 @@ const apiAuthPlugin: FastifyPluginAsync = async function(
|
|||||||
try {
|
try {
|
||||||
if (request.roles.indexOf('svr') >= 0) {
|
if (request.roles.indexOf('svr') >= 0) {
|
||||||
// TODO: check svr
|
// TODO: check svr
|
||||||
return;
|
} else {
|
||||||
}
|
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
let { accountid, sessionid } = request.params;
|
let { accountid, sessionid } = request.params;
|
||||||
//TODO: 增加sessionid的校验
|
//TODO: 增加sessionid的校验
|
||||||
@ -53,6 +52,8 @@ const apiAuthPlugin: FastifyPluginAsync = async function(
|
|||||||
return reply.send({code: 4, msg: 'account locked'});
|
return reply.send({code: 4, msg: 'account locked'});
|
||||||
}
|
}
|
||||||
request.user = account;
|
request.user = account;
|
||||||
|
}
|
||||||
|
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
return reply.send({code: 401, msg: 'need auth'})
|
return reply.send({code: 401, msg: 'need auth'})
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user