fix: 0day auth

Signed-off-by: Innei <i@innei.in>
This commit is contained in:
Innei
2024-09-04 12:16:21 +08:00
parent 54307a0897
commit 3451d2f065

View File

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