chore: fix auth problem
This commit is contained in:
@@ -61,10 +61,11 @@ export class AuthService {
|
||||
await queryRunner.startTransaction();
|
||||
//
|
||||
const isValid = await this.otpService.verifyOtp(phone, code, "REGISTER");
|
||||
|
||||
if (!isValid) throw new BadRequestException(AuthMessage.INVALID_OTP);
|
||||
|
||||
await this.otpService.delOtpFormCache(phone, "REGISTER");
|
||||
const existUser = await this.usersService.findOneWithPhone(phone);
|
||||
if (existUser) throw new BadRequestException(AuthMessage.PHONE_EXISTS);
|
||||
|
||||
const hashedPassword = await this.passwordService.hashPassword(completeRegistrationDto.password);
|
||||
const user = await this.usersService.createUser(completeRegistrationDto, hashedPassword, queryRunner);
|
||||
|
||||
@@ -83,6 +84,8 @@ export class AuthService {
|
||||
});
|
||||
}
|
||||
|
||||
await this.otpService.delOtpFormCache(phone, "REGISTER");
|
||||
|
||||
await queryRunner.commitTransaction();
|
||||
|
||||
return {
|
||||
|
||||
Reference in New Issue
Block a user