mirror of
https://github.com/cool-team-official/cool-admin-midway.git
synced 2024-11-01 22:20:30 +08:00
修复超级管理员判断密码版本
This commit is contained in:
parent
9f0034bd84
commit
8b914567cd
@ -59,6 +59,18 @@ export class BaseAuthorityMiddleware
|
||||
const rToken = await this.cacheManager.get(
|
||||
`admin:token:${ctx.admin.userId}`
|
||||
);
|
||||
// 判断密码版本是否正确
|
||||
const passwordV = await this.cacheManager.get(
|
||||
`admin:passwordVersion:${ctx.admin.userId}`
|
||||
);
|
||||
if (passwordV != ctx.admin.passwordVersion) {
|
||||
ctx.status = 401;
|
||||
ctx.body = {
|
||||
code: RESCODE.COMMFAIL,
|
||||
message: '登录失效~',
|
||||
};
|
||||
return;
|
||||
}
|
||||
// 超管拥有所有权限
|
||||
if (ctx.admin.username == 'admin' && !ctx.admin.isRefresh) {
|
||||
if (rToken !== token && this.jwtConfig.jwt.sso) {
|
||||
@ -91,19 +103,6 @@ export class BaseAuthorityMiddleware
|
||||
};
|
||||
return;
|
||||
}
|
||||
// 判断密码版本是否正确
|
||||
const passwordV = await this.cacheManager.get(
|
||||
`admin:passwordVersion:${ctx.admin.userId}`
|
||||
);
|
||||
if (passwordV != ctx.admin.passwordVersion) {
|
||||
ctx.status = 401;
|
||||
ctx.body = {
|
||||
code: RESCODE.COMMFAIL,
|
||||
message: '登录失效~',
|
||||
};
|
||||
return;
|
||||
}
|
||||
|
||||
if (!rToken) {
|
||||
ctx.status = 401;
|
||||
ctx.body = {
|
||||
|
Loading…
Reference in New Issue
Block a user