Add user active check and improve error handling in auth services

This commit is contained in:
faris Aljohari
2025-01-04 20:06:44 -06:00
parent 7ca9c19a2e
commit 97da38e31d
2 changed files with 4 additions and 1 deletions

View File

@ -45,6 +45,9 @@ export class AuthService {
if (!user.isUserVerified) {
throw new BadRequestException('User is not verified');
}
if (!user.isActive) {
throw new BadRequestException('User is not active');
}
if (user) {
const passwordMatch = this.helperHashService.bcryptCompare(
pass,

View File

@ -151,7 +151,7 @@ export class UserAuthService {
});
return res;
} catch (error) {
throw new BadRequestException('Invalid credentials');
throw new BadRequestException(error.message || 'Invalid credentials');
}
}