fix: auth

Signed-off-by: Innei <i@innei.in>
This commit is contained in:
Innei
2024-09-04 12:19:50 +08:00
parent 682908dedc
commit 311f2de80c

View File

@@ -67,13 +67,13 @@ export class AuthGuard implements CanActivate {
}
const valid = await this.authService.jwtServicePublic.verify(jwt)
if (valid)
this.attachUserAndToken(
request,
await this.userService.getMaster(),
Authorization,
)
throw new UnauthorizedException('令牌无效')
if (!valid) throw new UnauthorizedException('身份过期')
this.attachUserAndToken(
request,
await this.userService.getMaster(),
Authorization,
)
return true
}
getRequest(context: ExecutionContext) {