diff --git a/src/common/utils/helper/resendOtpHelper.ts b/src/common/utils/helper/resendOtpHelper.ts index 4f8eaa6..7c2fc48 100644 --- a/src/common/utils/helper/resendOtpHelper.ts +++ b/src/common/utils/helper/resendOtpHelper.ts @@ -12,7 +12,6 @@ export interface OtpResult { export async function resendOtpHelper( prisma: any, userId: number, - email: string, emailPurpose: "Register" | "Login" | "ForgotPassword", otpLength: 4 | 6 = 4, expiryMinutes: number = 5 diff --git a/src/modules/host/handlers/resendOtp.ts b/src/modules/host/handlers/resendOtp.ts index 3950735..cda0bcd 100644 --- a/src/modules/host/handlers/resendOtp.ts +++ b/src/modules/host/handlers/resendOtp.ts @@ -41,9 +41,11 @@ export const handler = safeHandler( const email = (body.email || "").trim(); if (!email) throw new ApiError(400, "Email is required"); + const emailToLowerCase = email.toLowerCase(); + // find user (you can adapt the isActive / userStatus checks per your rules) const user = await prisma.user.findUnique({ - where: { emailAddress: email, isActive: true }, + where: { emailAddress: emailToLowerCase, isActive: true }, select: { id: true, emailAddress: true, role: true }, }); @@ -56,7 +58,6 @@ export const handler = safeHandler( const otpResult = await resendOtpHelper( prisma, user.id, - user.emailAddress, purpose, 6, // 6-digit OTP 5 // expires in 5 minutes