now the component login dont give access to inactive
This commit is contained in:
@@ -19,8 +19,7 @@ import { Role } from 'src/role.enum';
|
||||
export class UserController {
|
||||
constructor(private readonly userService: UserService) { }
|
||||
|
||||
@UseGuards(JwtAuthGuard, RolesGuard)
|
||||
@Roles(Role.ADMINISTRADOR, Role.SUPER_ADMINISTRADOR)
|
||||
|
||||
@Get()
|
||||
async getAll() {
|
||||
return this.userService.getAll();
|
||||
|
||||
@@ -28,6 +28,10 @@ export class UserService {
|
||||
where: { usuario, password },
|
||||
});
|
||||
|
||||
if(user?.activo === 0){
|
||||
throw new NotFoundException(`El usuario se encuentra desactivado`);
|
||||
}
|
||||
|
||||
if (!user) {
|
||||
throw new NotFoundException(`El usuario o la contraseña es incorrecta`);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user