diff --git a/backend/src/auth/auth.service.ts b/backend/src/auth/auth.service.ts index a2281e2..c1bda47 100644 --- a/backend/src/auth/auth.service.ts +++ b/backend/src/auth/auth.service.ts @@ -34,6 +34,8 @@ export class AuthService { const valid = await bcrypt.compare(password, user.password_hash); if (!valid) throw new UnauthorizedException('Credenciales inválidas'); + if (user.is_active === false) throw new UnauthorizedException('Tu cuenta ha sido bloqueada'); + return this.generateToken(user); } @@ -51,6 +53,7 @@ export class AuthService { data: { phone, name: name || phone, is_phone_verified: true }, }); } else { + if (user.is_active === false) throw new UnauthorizedException('Tu cuenta ha sido bloqueada'); user = await this.prisma.users.update({ where: { id: user.id }, data: { is_phone_verified: true }, @@ -107,6 +110,7 @@ export class AuthService { }, }); if (!user) throw new UnauthorizedException('Usuario no encontrado'); + if (user.is_active === false) throw new UnauthorizedException('Tu cuenta ha sido bloqueada'); return { ...user, professional_state: user.pro_state }; }