refactor: atualizações e remoção de módulos não utilizados
This commit is contained in:
@@ -31,7 +31,7 @@ export class JwtStrategy extends PassportStrategy(Strategy) {
|
||||
}
|
||||
|
||||
const token = req.headers?.authorization?.replace('Bearer ', '');
|
||||
if (token && await this.tokenBlacklistService.isBlacklisted(token)) {
|
||||
if (token && (await this.tokenBlacklistService.isBlacklisted(token))) {
|
||||
throw new UnauthorizedException('Token foi invalidado');
|
||||
}
|
||||
|
||||
@@ -39,15 +39,16 @@ export class JwtStrategy extends PassportStrategy(Strategy) {
|
||||
const cachedUser = await this.redis.get<any>(sessionKey);
|
||||
|
||||
if (cachedUser) {
|
||||
const isSessionActive = await this.sessionManagementService.isSessionActive(
|
||||
payload.id,
|
||||
payload.sessionId
|
||||
);
|
||||
|
||||
const isSessionActive =
|
||||
await this.sessionManagementService.isSessionActive(
|
||||
payload.id,
|
||||
payload.sessionId,
|
||||
);
|
||||
|
||||
if (!isSessionActive) {
|
||||
throw new UnauthorizedException('Sessão expirada ou inválida');
|
||||
}
|
||||
|
||||
|
||||
return {
|
||||
id: cachedUser.id,
|
||||
sellerId: cachedUser.sellerId,
|
||||
@@ -65,7 +66,9 @@ export class JwtStrategy extends PassportStrategy(Strategy) {
|
||||
}
|
||||
|
||||
if (user.situacao === 'B') {
|
||||
throw new UnauthorizedException('Usuário bloqueado, acesso não permitido');
|
||||
throw new UnauthorizedException(
|
||||
'Usuário bloqueado, acesso não permitido',
|
||||
);
|
||||
}
|
||||
|
||||
const userData = {
|
||||
|
||||
Reference in New Issue
Block a user