diff --git a/src/auth/auth-services/user.auth.service.ts b/src/auth/auth-services/user.auth.service.ts index 882a565..347377d 100644 --- a/src/auth/auth-services/user.auth.service.ts +++ b/src/auth/auth-services/user.auth.service.ts @@ -1,4 +1,5 @@ import { + BadRequestException, HttpException, HttpStatus, Injectable, @@ -96,6 +97,7 @@ export class UserAuthService { return new LoginDtoRs(newUser); } if (userExist) { + if (userExist.otpExpire > new Date(new Date().getTime()).getTime()) throw new BadRequestException("Wait for expiry time to finish"); await this.smsSender(otp, mobile); const updateTokens = await this.userDbService.findOneAndUpdate( {