diff --git a/src/user/services/user.service.ts b/src/user/services/user.service.ts index 188accb..73e2e58 100644 --- a/src/user/services/user.service.ts +++ b/src/user/services/user.service.ts @@ -226,7 +226,15 @@ export class UserService { if (userWithEmail) { if (userWithEmail.id === userId) { - return; + this.logger.log(`Generating OTP for current email ${email} for user ${userId}`); + await this.userRepository.update(userId, { isEmailVerified: false }); + + return this.otpService.generateAndSendOtp({ + userId, + recipient: email, + otpType: OtpType.EMAIL, + scope: OtpScope.VERIFY_EMAIL, + }); } this.logger.error(`Email ${email} is already taken by another user`);