GWM : forget password api changes

This commit is contained in:
Gowtham M 2026-06-19 16:05:05 +05:30
parent 679a074da8
commit 010e59811b

View File

@ -1057,16 +1057,17 @@ exports.forgotPasswordRequestOTP = async (req, res) => {
{
// Validate inputs
if (!establishment_name || !establishment_code || !registered_email)
return res.status(400).json({ status: "failed", message: "All fields are required" });
// if (!establishment_name || !establishment_code || !registered_email)
// return res.status(400).json({ status: "failed", message: "All fields are required" });
// Find establishment and user
const establishment = await Establishment.findOne({ where: { establishment_code } });
if (!establishment)
return res.status(404).json({ status: "failed", message: "Establishment not found" });
// // Find establishment and user
// const establishment = await Establishment.findOne({ where: { establishment_code } });
// if (!establishment)
// return res.status(404).json({ status: "failed", message: "Establishment not found" });
const user = await EstablishmentUser.findOne({
where: { email: registered_email, establishment_id: establishment.id },
// where: { email: registered_email, establishment_id: establishment.id },
where: { email: registered_email },
});
if (!user)