mirror of
https://github.com/SyncrowIOT/backend.git
synced 2025-11-26 07:34:54 +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) {
|
if (!user.isUserVerified) {
|
||||||
throw new BadRequestException('User is not verified');
|
throw new BadRequestException('User is not verified');
|
||||||
}
|
}
|
||||||
|
if (!user.isActive) {
|
||||||
|
throw new BadRequestException('User is not active');
|
||||||
|
}
|
||||||
if (user) {
|
if (user) {
|
||||||
const passwordMatch = this.helperHashService.bcryptCompare(
|
const passwordMatch = this.helperHashService.bcryptCompare(
|
||||||
pass,
|
pass,
|
||||||
|
|||||||
@ -151,7 +151,7 @@ export class UserAuthService {
|
|||||||
});
|
});
|
||||||
return res;
|
return res;
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
throw new BadRequestException('Invalid credentials');
|
throw new BadRequestException(error.message || 'Invalid credentials');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user