mirror of
https://github.com/SyncrowIOT/backend.git
synced 2025-07-16 10:46:17 +00:00
Fix user sign-up logic to correctly handle inactive users
This commit is contained in:
@ -36,10 +36,11 @@ export class UserAuthService {
|
|||||||
|
|
||||||
async signUp(userSignUpDto: UserSignUpDto): Promise<UserEntity> {
|
async signUp(userSignUpDto: UserSignUpDto): Promise<UserEntity> {
|
||||||
const findUser = await this.findUser(userSignUpDto.email);
|
const findUser = await this.findUser(userSignUpDto.email);
|
||||||
if (!findUser.isActive) {
|
|
||||||
throw new BadRequestException('User is not active');
|
|
||||||
}
|
|
||||||
if (findUser) {
|
if (findUser) {
|
||||||
|
if (!findUser.isActive) {
|
||||||
|
throw new BadRequestException('User is not active');
|
||||||
|
}
|
||||||
throw new BadRequestException('User already registered with given email');
|
throw new BadRequestException('User already registered with given email');
|
||||||
}
|
}
|
||||||
const salt = this.helperHashService.randomSalt(10); // Hash the password using bcrypt
|
const salt = this.helperHashService.randomSalt(10); // Hash the password using bcrypt
|
||||||
|
Reference in New Issue
Block a user