mirror of
https://github.com/SyncrowIOT/backend.git
synced 2025-07-16 02:36:19 +00:00
Add user active check and improve error handling in auth services
This commit is contained in:
@ -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,
|
||||
|
@ -151,7 +151,7 @@ export class UserAuthService {
|
||||
});
|
||||
return res;
|
||||
} catch (error) {
|
||||
throw new BadRequestException('Invalid credentials');
|
||||
throw new BadRequestException(error.message || 'Invalid credentials');
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user