From 7bd86e96e45db31a5613536c6ca25b99d859dfe6 Mon Sep 17 00:00:00 2001 From: Gowtham M Date: Wed, 19 Nov 2025 14:31:45 +0530 Subject: [PATCH 1/2] GWM : forgot pw changes --- app/controllers/establishment.controller.js | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/app/controllers/establishment.controller.js b/app/controllers/establishment.controller.js index a5effed..5a7167c 100644 --- a/app/controllers/establishment.controller.js +++ b/app/controllers/establishment.controller.js @@ -763,6 +763,13 @@ exports.forgotPasswordRequestOTP = async (req, res) => { reset_otp_expires_at: new Date(Date.now() + 10 * 60 * 1000), // valid for 10 mins }); + // Send OTP email + await sendEmail( + registered_email, + "Password Reset OTP", + `

Dear ${user.name},

Your OTP for password reset is ${otp}. It is valid for 10 minutes.

` + ); + }else{ const adminUser = await user.findOne({where: { email: registered_email },}); @@ -782,11 +789,6 @@ exports.forgotPasswordRequestOTP = async (req, res) => { reset_otp_expires_at: new Date(Date.now() + 10 * 60 * 1000), // valid for 10 mins }); - - } - - - // Send OTP email await sendEmail( registered_email, @@ -794,7 +796,13 @@ exports.forgotPasswordRequestOTP = async (req, res) => { `

Dear ${user.name},

Your OTP for password reset is ${otp}. It is valid for 10 minutes.

` ); - logger.info(`OTP sent to ${registered_email} for establishment_id=${establishment.id}`); + + } + + + + + logger.info(`OTP sent to ${registered_email}`); return res.status(200).json({ status: "success", From e4b64b4add8f4c8f9161e47a0d477271bbe6cc79 Mon Sep 17 00:00:00 2001 From: Gowtham M Date: Wed, 19 Nov 2025 14:33:50 +0530 Subject: [PATCH 2/2] GWM : forgot pw changes --- app/controllers/establishment.controller.js | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/app/controllers/establishment.controller.js b/app/controllers/establishment.controller.js index 5131bc2..5e73dcd 100644 --- a/app/controllers/establishment.controller.js +++ b/app/controllers/establishment.controller.js @@ -793,7 +793,7 @@ exports.forgotPasswordRequestOTP = async (req, res) => { await sendEmail( registered_email, "Password Reset OTP", - `

Dear ${user.name},

Your OTP for password reset is ${otp}. It is valid for 10 minutes.

` + `

Dear ${adminUser.name},

Your OTP for password reset is ${otp}. It is valid for 10 minutes.

` ); @@ -876,8 +876,6 @@ exports.forgotPasswordVerifyOTP = async (req, res) => { } - - logger.info(`Password reset successful for user=${registered_email}`); return res.status(200).json({