GWM : forgot pw changes

This commit is contained in:
Gowtham M 2025-11-19 14:31:45 +05:30
parent bd020d4aef
commit 7bd86e96e4

View File

@ -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",
`<p>Dear ${user.name},</p><p>Your OTP for password reset is <b>${otp}</b>. It is valid for 10 minutes.</p>`
);
}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) => {
`<p>Dear ${user.name},</p><p>Your OTP for password reset is <b>${otp}</b>. It is valid for 10 minutes.</p>`
);
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",