From 21d31538be56e9ee565c577ecf31b313ec435340 Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 12 Sep 2024 16:31:15 +0300 Subject: [PATCH] added otp handling user --- src/auth/services/user-auth.service.ts | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/auth/services/user-auth.service.ts b/src/auth/services/user-auth.service.ts index 7b539e2..976731b 100644 --- a/src/auth/services/user-auth.service.ts +++ b/src/auth/services/user-auth.service.ts @@ -225,7 +225,15 @@ export class UserAuthService { }); if (!otp) { - throw new BadRequestException('this email is not registered'); + const user = await this.userRepository.findOne({ + where: { + email: data.email, + }, + }); + if (user) { + throw new BadRequestException('this email is not registered'); + } + throw new BadRequestException('You entered wrong otp'); } if (otp.otpCode !== data.otpCode) {