create and reset password Email template was changed
This commit is contained in:
parent
8dec31d038
commit
3f63e65138
@ -337,13 +337,29 @@ export const createretaildistributor = async (req, res) => {
|
|||||||
await sendEmail({
|
await sendEmail({
|
||||||
to: `${email}`, // Change to your recipient
|
to: `${email}`, // Change to your recipient
|
||||||
from: `${process.env.SEND_EMAIL_FROM}`, // Change to your verified sender
|
from: `${process.env.SEND_EMAIL_FROM}`, // Change to your verified sender
|
||||||
subject: `Cheminova Account Created`,
|
subject: `Welcome to Cheminova - Account Created Successfully`,
|
||||||
html: `Your Retail Distributor Account is created successfully.
|
html: `
|
||||||
<br/>name is: <strong>${name}</strong>
|
<p>Dear ${name},</p>
|
||||||
<br/>
|
<p>We are pleased to inform you that your retailer account has been successfully created. Please find your account details below:</p>
|
||||||
<br/>MobileNumber is: <strong>${mobile_number}</strong><br/>
|
<p><strong>Name:</strong> ${name}</p>
|
||||||
|
<p><strong>Mobile Number:</strong> ${mobile_number}</p>
|
||||||
<br/>Email is: <strong>${email}</strong><br/>
|
<br/>Email is: <strong>${email}</strong><br/>
|
||||||
<br/>password is: <strong>${password}</strong><br/><br/>If you have not requested this email, please ignore it.`,
|
<p><strong>Password:</strong> ${password}</p>
|
||||||
|
<br/>
|
||||||
|
<p>You can log in to your account using the following link:</p>
|
||||||
|
<p><a href="https://rd.cnapp.co.in/#/login" target="_blank" style="color: #0066cc; text-decoration: none;">Click here to log in</a></p>
|
||||||
|
<br/>
|
||||||
|
<p>For convenience, you can also download our mobile app from the following links:</p>
|
||||||
|
<ul>
|
||||||
|
<li><a href="https://drive.google.com/file/d/1SO-AgM5-cRRwDGRg9fmxDNTGNTZkBRo6/view?usp=sharing
|
||||||
|
" target="_blank" style="color: #0066cc; text-decoration: none;">Download Mobile Application</a></li>
|
||||||
|
</ul>
|
||||||
|
<br/>
|
||||||
|
<p>If you have not requested this email or have any concerns, please contact our support team immediately.</p>
|
||||||
|
<br/>
|
||||||
|
<p>Best regards,</p>
|
||||||
|
<p><strong>Cheminova Support Team</strong></p>
|
||||||
|
`,
|
||||||
});
|
});
|
||||||
// Send response
|
// Send response
|
||||||
res.status(201).json({
|
res.status(201).json({
|
||||||
@ -550,12 +566,29 @@ export const updateKycStatus = async (req, res) => {
|
|||||||
await sendEmail({
|
await sendEmail({
|
||||||
to: kyc.email,
|
to: kyc.email,
|
||||||
from: process.env.SEND_EMAIL_FROM,
|
from: process.env.SEND_EMAIL_FROM,
|
||||||
subject: `Cheminova Account Created`,
|
subject: `Welcome to Cheminova - Account Created Successfully`,
|
||||||
html: `Your Retail Distributor Account is created successfully.
|
html: `
|
||||||
<br/>name is: <strong>${kyc.name}</strong>
|
<p>Dear ${kyc.name},</p>
|
||||||
<br/>Mobile Number is: <strong>${kyc.mobile_number}</strong><br/>
|
<p>We are pleased to inform you that your Retailer account has been successfully created. Please find your account details below:</p>
|
||||||
|
<p><strong>Name:</strong> ${kyc.name}</p>
|
||||||
|
<p><strong>Mobile Number:</strong> ${kyc.mobile_number}</p>
|
||||||
<br/>Email is: <strong>${kyc.email}</strong><br/>
|
<br/>Email is: <strong>${kyc.email}</strong><br/>
|
||||||
<br/>password is: <strong>${password}</strong><br/><br/>If you have not requested this email, please ignore it.`,
|
<p><strong>Password:</strong> ${password}</p>
|
||||||
|
<br/>
|
||||||
|
<p>You can log in to your account using the following link:</p>
|
||||||
|
<p><a href="https://rd.cnapp.co.in/#/login" target="_blank" style="color: #0066cc; text-decoration: none;">Click here to log in</a></p>
|
||||||
|
<br/>
|
||||||
|
<p>For convenience, you can also download our mobile app from the following links:</p>
|
||||||
|
<ul>
|
||||||
|
<li><a href="https://drive.google.com/file/d/1SO-AgM5-cRRwDGRg9fmxDNTGNTZkBRo6/view?usp=sharing
|
||||||
|
" target="_blank" style="color: #0066cc; text-decoration: none;">Download Mobile Application</a></li>
|
||||||
|
</ul>
|
||||||
|
<br/>
|
||||||
|
<p>If you have not requested this email or have any concerns, please contact our support team immediately.</p>
|
||||||
|
<br/>
|
||||||
|
<p>Best regards,</p>
|
||||||
|
<p><strong>Cheminova Support Team</strong></p>
|
||||||
|
`,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -304,13 +304,29 @@ export const uploadRetaildistributors = async (req, res) => {
|
|||||||
await sendEmail({
|
await sendEmail({
|
||||||
to: `${item.email}`, // Change to your recipient
|
to: `${item.email}`, // Change to your recipient
|
||||||
from: `${process.env.SEND_EMAIL_FROM}`, // Change to your verified sender
|
from: `${process.env.SEND_EMAIL_FROM}`, // Change to your verified sender
|
||||||
subject: `Cheminova Account Created`,
|
subject: `Welcome to Cheminova - Account Created Successfully`,
|
||||||
html: `Your Retail Distributor Account is created successfully.
|
html: `
|
||||||
<br/>name is: <strong>${item.name}</strong>
|
<p>Dear ${name},</p>
|
||||||
|
<p>We are pleased to inform you that your Retailer account has been successfully created. Please find your account details below:</p>
|
||||||
|
<p><strong>Name:</strong> ${item.name}</p>
|
||||||
|
<p><strong>Mobile Number:</strong> ${item.mobile_number}</p>
|
||||||
|
<p><strong>Email:</strong> ${item.email}</p>
|
||||||
|
<p><strong>Password:</strong> ${password}</p>
|
||||||
<br/>
|
<br/>
|
||||||
<br/>MobileNumber is: <strong>${item.mobile_number}</strong><br/>
|
<p>You can log in to your account using the following link:</p>
|
||||||
<br/>Email is: <strong>${item.email}</strong><br/>
|
<p><a href=" https://rd.cnapp.co.in/#/login " target="_blank" style="color: #0066cc; text-decoration: none;">Click here to log in</a></p>
|
||||||
<br/>password is: <strong>${password}</strong><br/><br/>If you have not requested this email, please ignore it.`,
|
<br/>
|
||||||
|
<p>For convenience, you can also download our mobile app from the following links:</p>
|
||||||
|
<ul>
|
||||||
|
<li><a href="https://drive.google.com/file/d/1SO-AgM5-cRRwDGRg9fmxDNTGNTZkBRo6/view?usp=sharing
|
||||||
|
" target="_blank" style="color: #0066cc; text-decoration: none;">Download Mobile Application</a></li>
|
||||||
|
</ul>
|
||||||
|
<br/>
|
||||||
|
<p>If you have not requested this email or have any concerns, please contact our support team immediately.</p>
|
||||||
|
<br/>
|
||||||
|
<p>Best regards,</p>
|
||||||
|
<p><strong>Cheminova Support Team</strong></p>
|
||||||
|
`,
|
||||||
});
|
});
|
||||||
newlyCreated.push({ Kyc });
|
newlyCreated.push({ Kyc });
|
||||||
}
|
}
|
||||||
@ -335,7 +351,6 @@ export const uploadRetaildistributors = async (req, res) => {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
// Helper function to upload images to Cloudinary
|
// Helper function to upload images to Cloudinary
|
||||||
const uploadImage = async (image, folder) => {
|
const uploadImage = async (image, folder) => {
|
||||||
if (!image) return null;
|
if (!image) return null;
|
||||||
@ -391,24 +406,38 @@ export const updateretaildistributorwithKYC = async (req, res) => {
|
|||||||
kycUpdates.pan_img = await uploadImage(files.panImg, "KYC/pan");
|
kycUpdates.pan_img = await uploadImage(files.panImg, "KYC/pan");
|
||||||
}
|
}
|
||||||
if (files.aadharImg) {
|
if (files.aadharImg) {
|
||||||
kycUpdates.aadhar_img = await uploadImage(files.aadharImg, "KYC/aadhar");
|
kycUpdates.aadhar_img = await uploadImage(
|
||||||
|
files.aadharImg,
|
||||||
|
"KYC/aadhar"
|
||||||
|
);
|
||||||
}
|
}
|
||||||
if (files.gstImg) {
|
if (files.gstImg) {
|
||||||
kycUpdates.gst_img = await uploadImage(files.gstImg, "KYC/gst");
|
kycUpdates.gst_img = await uploadImage(files.gstImg, "KYC/gst");
|
||||||
}
|
}
|
||||||
if (files.pesticideLicenseImg) {
|
if (files.pesticideLicenseImg) {
|
||||||
kycUpdates.pesticide_license_img = await uploadImage(files.pesticideLicenseImg, "KYC/pesticide_license");
|
kycUpdates.pesticide_license_img = await uploadImage(
|
||||||
|
files.pesticideLicenseImg,
|
||||||
|
"KYC/pesticide_license"
|
||||||
|
);
|
||||||
}
|
}
|
||||||
if (files.fertilizerLicenseImg) {
|
if (files.fertilizerLicenseImg) {
|
||||||
kycUpdates.fertilizer_license_img = await uploadImage(files.fertilizerLicenseImg, "KYC/fertilizer_license");
|
kycUpdates.fertilizer_license_img = await uploadImage(
|
||||||
|
files.fertilizerLicenseImg,
|
||||||
|
"KYC/fertilizer_license"
|
||||||
|
);
|
||||||
}
|
}
|
||||||
if (files.selfieEntranceImg) {
|
if (files.selfieEntranceImg) {
|
||||||
kycUpdates.selfie_entrance_img = await uploadImage(files.selfieEntranceImg, "KYC/selfie_entrance");
|
kycUpdates.selfie_entrance_img = await uploadImage(
|
||||||
|
files.selfieEntranceImg,
|
||||||
|
"KYC/selfie_entrance"
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update the KYC model
|
// Update the KYC model
|
||||||
const updatedKYC = await KYC.findByIdAndUpdate(kycId, kycUpdates, { new: true });
|
const updatedKYC = await KYC.findByIdAndUpdate(kycId, kycUpdates, {
|
||||||
|
new: true,
|
||||||
|
});
|
||||||
if (!updatedKYC) {
|
if (!updatedKYC) {
|
||||||
return res.status(404).json({ message: "KYC record not found" });
|
return res.status(404).json({ message: "KYC record not found" });
|
||||||
}
|
}
|
||||||
@ -442,7 +471,8 @@ export const updateretaildistributorwithKYC = async (req, res) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
res.status(200).json({
|
res.status(200).json({
|
||||||
message: "Retail Distributor, KYC, and Shipping Address updated successfully",
|
message:
|
||||||
|
"Retail Distributor, KYC, and Shipping Address updated successfully",
|
||||||
success: true,
|
success: true,
|
||||||
retailDistributor: updatedRetailDistributor,
|
retailDistributor: updatedRetailDistributor,
|
||||||
kyc: updatedKYC,
|
kyc: updatedKYC,
|
||||||
@ -626,11 +656,19 @@ export const ResetPassword = async (req, res) => {
|
|||||||
subject: "Cheminova Account Credentials",
|
subject: "Cheminova Account Credentials",
|
||||||
html: `
|
html: `
|
||||||
<p>Dear ${Retailers.name},</p>
|
<p>Dear ${Retailers.name},</p>
|
||||||
<p>Your account credentials have been updated. Please find your new login details below:</p>
|
<p>Your Retailer account credentials have been updated. Please find your new login details below:</p>
|
||||||
<p><strong>Email:</strong> ${Retailers.email}</p>
|
<p><strong>Email:</strong> ${Retailers.email}</p>
|
||||||
<p><strong>Password:</strong> ${newPassword}</p>
|
<p><strong>Password:</strong> ${newPassword}</p>
|
||||||
<p>Please use these credentials to log in to your account. For security reasons, it's recommended to change your password after logging in.</p>
|
<p>Please use these credentials to log in to your account. For security reasons, it's recommended to change your password after logging in.</p>
|
||||||
<br/>
|
<br/>
|
||||||
|
<p>To log in via our website, please <a href="https://rd.cnapp.co.in/#/login" target="_blank">click here</a>.</p>
|
||||||
|
<p>To download our mobile app, use the following links:</p>
|
||||||
|
<ul>
|
||||||
|
<li><a href="https://drive.google.com/file/d/1SO-AgM5-cRRwDGRg9fmxDNTGNTZkBRo6/view?usp=sharing
|
||||||
|
" target="_blank">Download Mobile Application</a></li>
|
||||||
|
|
||||||
|
</ul>
|
||||||
|
<br/>
|
||||||
<p>If you did not request this change, please contact our support team immediately.</p>
|
<p>If you did not request this change, please contact our support team immediately.</p>
|
||||||
<br/>
|
<br/>
|
||||||
<p>Best regards,</p>
|
<p>Best regards,</p>
|
||||||
@ -1911,7 +1949,10 @@ export const generateRetailerReport = async (req, res) => {
|
|||||||
try {
|
try {
|
||||||
// Fetch retailer data and populate required fields
|
// Fetch retailer data and populate required fields
|
||||||
const retailers = await RetailDistributor.find()
|
const retailers = await RetailDistributor.find()
|
||||||
.populate("kyc", "trade_name pan_number aadhar_number gst_number state city district address pincode")
|
.populate(
|
||||||
|
"kyc",
|
||||||
|
"trade_name pan_number aadhar_number gst_number state city district address pincode"
|
||||||
|
)
|
||||||
.populate("principal_distributer", "name")
|
.populate("principal_distributer", "name")
|
||||||
.populate("mappedTM", "name")
|
.populate("mappedTM", "name")
|
||||||
.populate("mappedSC", "name")
|
.populate("mappedSC", "name")
|
||||||
|
@ -231,11 +231,29 @@ export const uploadSalesCoordinators = async (req, res) => {
|
|||||||
await sendEmail({
|
await sendEmail({
|
||||||
to: `${item?.email}`, // Change to your recipient
|
to: `${item?.email}`, // Change to your recipient
|
||||||
from: `${process.env.SEND_EMAIL_FROM}`, // Change to your verified sender
|
from: `${process.env.SEND_EMAIL_FROM}`, // Change to your verified sender
|
||||||
subject: `Cheminova Account Created`,
|
subject: `Welcome to Cheminova - Account Created Successfully`,
|
||||||
html: `Your Sales Coordinator Account is created successfully.
|
html: `
|
||||||
<br/>Name: <strong>${item?.name}</strong><br/>
|
<p>Dear ${item?.name},</p>
|
||||||
<br/>Mobile Number: <strong>${item?.mobileNumber}</strong><br/>
|
<p>We are pleased to inform you that your Sales Coordinator account has been successfully created. Please find your account details below:</p>
|
||||||
<br/>Password: <strong>${password}</strong><br/><br/>If you have not requested this email, please ignore it.`,
|
<p><strong>Name:</strong> ${item?.name}</p>
|
||||||
|
<p><strong>Mobile Number:</strong> ${item?.mobileNumber}</p>
|
||||||
|
<p><strong>Email:</strong> ${item.email}</p>
|
||||||
|
<p><strong>Password:</strong> ${password}</p>
|
||||||
|
<br/>
|
||||||
|
<p>You can log in to your account using the following link:</p>
|
||||||
|
|
||||||
|
<br/>
|
||||||
|
<p>For convenience, you can also download our mobile app from the following links:</p>
|
||||||
|
<ul>
|
||||||
|
<li><a href="https://drive.google.com/file/d/1S8oJRz90LImcFBgMrqWZkWXDR79aBoot/view?usp=sharing
|
||||||
|
" target="_blank" style="color: #0066cc; text-decoration: none;">Download Mobile Application</a></li>
|
||||||
|
</ul>
|
||||||
|
<br/>
|
||||||
|
<p>If you have not requested this email or have any concerns, please contact our support team immediately.</p>
|
||||||
|
<br/>
|
||||||
|
<p>Best regards,</p>
|
||||||
|
<p><strong>Cheminova Support Team</strong></p>
|
||||||
|
`,
|
||||||
});
|
});
|
||||||
newlyCreated.push({ salesCoordinator });
|
newlyCreated.push({ salesCoordinator });
|
||||||
}
|
}
|
||||||
@ -357,11 +375,29 @@ export const verifyOtp = async (req, res) => {
|
|||||||
await sendEmail({
|
await sendEmail({
|
||||||
to: `${salesCoordinator?.email}`, // Change to your recipient
|
to: `${salesCoordinator?.email}`, // Change to your recipient
|
||||||
from: `${process.env.SEND_EMAIL_FROM}`, // Change to your verified sender
|
from: `${process.env.SEND_EMAIL_FROM}`, // Change to your verified sender
|
||||||
subject: `Cheminova Account Created`,
|
subject: `Welcome to Cheminova - Account Created Successfully`,
|
||||||
html: `Your Sales Coordinator Account is created successfully.
|
html: `
|
||||||
<br/>name is: <strong>${name}</strong><br/>
|
<p>Dear ${name},</p>
|
||||||
<br/>MobileNumber is: <strong>${mobile}</strong><br/>
|
<p>We are pleased to inform you that your Sales Coordinator account has been successfully created. Please find your account details below:</p>
|
||||||
<br/>password is: <strong>${newPassword}</strong><br/><br/>If you have not requested this email, please ignore it.`,
|
<p><strong>Name:</strong> ${name}</p>
|
||||||
|
<p><strong>Mobile Number:</strong> ${mobile}</p>
|
||||||
|
<p><strong>Email:</strong> ${salesCoordinator.email}</p>
|
||||||
|
<p><strong>Password:</strong> ${newPassword}</p>
|
||||||
|
<br/>
|
||||||
|
<p>You can log in to your account using the following link:</p>
|
||||||
|
|
||||||
|
<br/>
|
||||||
|
<p>For convenience, you can also download our mobile app from the following links:</p>
|
||||||
|
<ul>
|
||||||
|
<li><a href="https://drive.google.com/file/d/1S8oJRz90LImcFBgMrqWZkWXDR79aBoot/view?usp=sharing
|
||||||
|
" target="_blank" style="color: #0066cc; text-decoration: none;">Download Mobile Application</a></li>
|
||||||
|
</ul>
|
||||||
|
<br/>
|
||||||
|
<p>If you have not requested this email or have any concerns, please contact our support team immediately.</p>
|
||||||
|
<br/>
|
||||||
|
<p>Best regards,</p>
|
||||||
|
<p><strong>Cheminova Support Team</strong></p>
|
||||||
|
`,
|
||||||
});
|
});
|
||||||
|
|
||||||
const token = salesCoordinator.getJWTToken();
|
const token = salesCoordinator.getJWTToken();
|
||||||
@ -752,11 +788,17 @@ export const ResetPassword = async (req, res) => {
|
|||||||
subject: "Cheminova Account Credentials",
|
subject: "Cheminova Account Credentials",
|
||||||
html: `
|
html: `
|
||||||
<p>Dear ${salescoordinator.name},</p>
|
<p>Dear ${salescoordinator.name},</p>
|
||||||
<p>Your account credentials have been updated. Please find your new login details below:</p>
|
<p>Your Sales Coordinator account credentials have been updated. Please find your new login details below:</p>
|
||||||
<p><strong>Email:</strong> ${salescoordinator.email}</p>
|
<p><strong>Email:</strong> ${salescoordinator.email}</p>
|
||||||
<p><strong>Password:</strong> ${newPassword}</p>
|
<p><strong>Password:</strong> ${newPassword}</p>
|
||||||
<p>Please use these credentials to log in to your account. For security reasons, it's recommended to change your password after logging in.</p>
|
<p>Please use these credentials to log in to your account. For security reasons, it's recommended to change your password after logging in.</p>
|
||||||
<br/>
|
<br/>
|
||||||
|
<p>To download our mobile app, use the following links:</p>
|
||||||
|
<ul>
|
||||||
|
<li><a href="https://drive.google.com/file/d/1S8oJRz90LImcFBgMrqWZkWXDR79aBoot/view?usp=sharing
|
||||||
|
" target="_blank">Download Mobile Application</a></li>
|
||||||
|
</ul>
|
||||||
|
<br/>
|
||||||
<p>If you did not request this change, please contact our support team immediately.</p>
|
<p>If you did not request this change, please contact our support team immediately.</p>
|
||||||
<br/>
|
<br/>
|
||||||
<p>Best regards,</p>
|
<p>Best regards,</p>
|
||||||
|
@ -229,11 +229,26 @@ export const uploadTerritoryManagers = async (req, res) => {
|
|||||||
await sendEmail({
|
await sendEmail({
|
||||||
to: `${item?.email}`, // Change to your recipient
|
to: `${item?.email}`, // Change to your recipient
|
||||||
from: `${process.env.SEND_EMAIL_FROM}`, // Change to your verified sender
|
from: `${process.env.SEND_EMAIL_FROM}`, // Change to your verified sender
|
||||||
subject: `Cheminova Account Created`,
|
subject: `Welcome to Cheminova - Account Created Successfully`,
|
||||||
html: `Your Territory Manager Account is created successfully.
|
html: `
|
||||||
<br/>name is: <strong>${item?.name}</strong><br/>
|
<p>Dear ${item.name},</p>
|
||||||
<br/>MobileNumber is: <strong>${item?.mobileNumber}</strong><br/>
|
<p>We are pleased to inform you that your Territory Manager account has been successfully created. Please find your account details below:</p>
|
||||||
<br/>password is: <strong>${password}</strong><br/><br/>If you have not requested this email, please ignore it.`,
|
<p><strong>Name:</strong> ${item.name}</p>
|
||||||
|
<p><strong>Mobile Number:</strong> ${item.mobileNumber}</p>
|
||||||
|
<p><strong>Email:</strong> ${item.email}</p>
|
||||||
|
<p><strong>Password:</strong> ${password}</p>
|
||||||
|
<br/>
|
||||||
|
<br/>
|
||||||
|
<p>For convenience, you can also download our mobile app from the following links:</p>
|
||||||
|
<ul>
|
||||||
|
<li><a href="https://drive.google.com/file/d/1GtG1ugGR2sIq2T23uMMvf-0jKGL1nh_n/view?usp=sharing" target="_blank" style="color: #0066cc; text-decoration: none;">Download Mobile Application</a></li>
|
||||||
|
</ul>
|
||||||
|
<br/>
|
||||||
|
<p>If you have not requested this email or have any concerns, please contact our support team immediately.</p>
|
||||||
|
<br/>
|
||||||
|
<p>Best regards,</p>
|
||||||
|
<p><strong>Cheminova Support Team</strong></p>
|
||||||
|
`,
|
||||||
});
|
});
|
||||||
newlyCreated.push({ territoryManager });
|
newlyCreated.push({ territoryManager });
|
||||||
}
|
}
|
||||||
@ -351,11 +366,26 @@ export const verifyOtp = async (req, res) => {
|
|||||||
await sendEmail({
|
await sendEmail({
|
||||||
to: `${territoryManager?.email}`, // Change to your recipient
|
to: `${territoryManager?.email}`, // Change to your recipient
|
||||||
from: `${process.env.SEND_EMAIL_FROM}`, // Change to your verified sender
|
from: `${process.env.SEND_EMAIL_FROM}`, // Change to your verified sender
|
||||||
subject: `Cheminova Account Created`,
|
subject: `Welcome to Cheminova - Account Created Successfully`,
|
||||||
html: `Your Territory Manager Account is created successfully.
|
html: `
|
||||||
<br/>name is: <strong>${name}</strong><br/>
|
<p>Dear ${name},</p>
|
||||||
<br/>MobileNumber is: <strong>${mobile}</strong><br/>
|
<p>We are pleased to inform you that your Territory Manager account has been successfully created. Please find your account details below:</p>
|
||||||
<br/>password is: <strong>${newPassword}</strong><br/><br/>If you have not requested this email, please ignore it.`,
|
<p><strong>Name:</strong> ${name}</p>
|
||||||
|
<p><strong>Mobile Number:</strong> ${mobile}</p>
|
||||||
|
<p><strong>Email:</strong> ${territoryManager.email}</p>
|
||||||
|
<p><strong>Password:</strong> ${newPassword}</p>
|
||||||
|
<br/>
|
||||||
|
<br/>
|
||||||
|
<p>For convenience, you can also download our mobile app from the following links:</p>
|
||||||
|
<ul>
|
||||||
|
<li><a href="https://drive.google.com/file/d/1GtG1ugGR2sIq2T23uMMvf-0jKGL1nh_n/view?usp=sharing" target="_blank" style="color: #0066cc; text-decoration: none;">Download Mobile Application</a></li>
|
||||||
|
</ul>
|
||||||
|
<br/>
|
||||||
|
<p>If you have not requested this email or have any concerns, please contact our support team immediately.</p>
|
||||||
|
<br/>
|
||||||
|
<p>Best regards,</p>
|
||||||
|
<p><strong>Cheminova Support Team</strong></p>
|
||||||
|
`,
|
||||||
});
|
});
|
||||||
|
|
||||||
const token = territoryManager.getJWTToken();
|
const token = territoryManager.getJWTToken();
|
||||||
@ -604,11 +634,16 @@ export const ResetPassword = async (req, res) => {
|
|||||||
subject: "Cheminova Account Credentials",
|
subject: "Cheminova Account Credentials",
|
||||||
html: `
|
html: `
|
||||||
<p>Dear ${territorymanager.name},</p>
|
<p>Dear ${territorymanager.name},</p>
|
||||||
<p>Your account credentials have been updated. Please find your new login details below:</p>
|
<p>Your Territory Manager account credentials have been updated. Please find your new login details below:</p>
|
||||||
<p><strong>Email:</strong> ${territorymanager.email}</p>
|
<p><strong>Email:</strong> ${territorymanager.email}</p>
|
||||||
<p><strong>Password:</strong> ${newPassword}</p>
|
<p><strong>Password:</strong> ${newPassword}</p>
|
||||||
<p>Please use these credentials to log in to your account. For security reasons, it's recommended to change your password after logging in.</p>
|
<p>Please use these credentials to log in to your account. For security reasons, it's recommended to change your password after logging in.</p>
|
||||||
<br/>
|
<br/>
|
||||||
|
<p>To download our mobile app, use the following links:</p>
|
||||||
|
<ul>
|
||||||
|
<li><a href="https://drive.google.com/file/d/1GtG1ugGR2sIq2T23uMMvf-0jKGL1nh_n/view?usp=sharing " target="_blank">Download Mobile Application</a></li>
|
||||||
|
</ul>
|
||||||
|
<br/>
|
||||||
<p>If you did not request this change, please contact our support team immediately.</p>
|
<p>If you did not request this change, please contact our support team immediately.</p>
|
||||||
<br/>
|
<br/>
|
||||||
<p>Best regards,</p>
|
<p>Best regards,</p>
|
||||||
|
@ -333,14 +333,29 @@ export const uploadPrincipaldistributors = async (req, res) => {
|
|||||||
await sendEmail({
|
await sendEmail({
|
||||||
to: distributor.email,
|
to: distributor.email,
|
||||||
from: process.env.SEND_EMAIL_FROM,
|
from: process.env.SEND_EMAIL_FROM,
|
||||||
subject: `Cheminova Account Created`,
|
subject: `Welcome to Cheminova - Account Created Successfully`,
|
||||||
html: `
|
html: `
|
||||||
Your Principal Distributor Account is created successfully.
|
<p>Dear ${distributor.name},</p>
|
||||||
<br/>Name: <strong>${distributor.name}</strong><br/>
|
<p>We are pleased to inform you that your Principal Distributor account has been successfully created. Please find your account details below:</p>
|
||||||
<br/>Mobile Number: <strong>${distributor.phone}</strong><br/>
|
<p><strong>Name:</strong> ${distributor.name}</p>
|
||||||
<br/>Password: <strong>${password}</strong><br/><br/>
|
<p><strong>Mobile Number:</strong> ${distributor.phone}</p>
|
||||||
<a href="${process.env.PD_APP_URL}/login">Click here to login</a><br/><br/>
|
<p><strong>Email:</strong> ${distributor.email}</p>
|
||||||
If you have not requested this email, please ignore it.
|
<p><strong>Password:</strong> ${distributor.password}</p>
|
||||||
|
<br/>
|
||||||
|
<p>You can log in to your account using the following link:</p>
|
||||||
|
<p><a href=" https://pd.cnapp.co.in/#/login
|
||||||
|
" target="_blank" style="color: #0066cc; text-decoration: none;">Click here to log in</a></p>
|
||||||
|
<br/>
|
||||||
|
<p>For convenience, you can also download our mobile app from the following links:</p>
|
||||||
|
<ul>
|
||||||
|
<li><a href="https://drive.google.com/file/d/1GOpyyEwfbE0cMzvHHx0Fr7UOFzrQVIlp/view?usp=sharing
|
||||||
|
" target="_blank" style="color: #0066cc; text-decoration: none;">Download Mobile Application</a></li>
|
||||||
|
</ul>
|
||||||
|
<br/>
|
||||||
|
<p>If you have not requested this email or have any concerns, please contact our support team immediately.</p>
|
||||||
|
<br/>
|
||||||
|
<p>Best regards,</p>
|
||||||
|
<p><strong>Cheminova Support Team</strong></p>
|
||||||
`,
|
`,
|
||||||
});
|
});
|
||||||
// Now create the address for the new user
|
// Now create the address for the new user
|
||||||
@ -441,14 +456,29 @@ export const registerUser = async (req, res) => {
|
|||||||
await sendEmail({
|
await sendEmail({
|
||||||
to: email,
|
to: email,
|
||||||
from: process.env.SEND_EMAIL_FROM,
|
from: process.env.SEND_EMAIL_FROM,
|
||||||
subject: `Cheminova Account Created`,
|
subject: `Welcome to Cheminova - Account Created Successfully`,
|
||||||
html: `
|
html: `
|
||||||
Your Principal Distributor Account is created successfully.
|
<p>Dear ${name},</p>
|
||||||
<br/>Name: <strong>${name}</strong><br/>
|
<p>We are pleased to inform you that your Principal Distributor account has been successfully created. Please find your account details below:</p>
|
||||||
<br/>Mobile Number: <strong>${phone}</strong><br/>
|
<p><strong>Name:</strong> ${name}</p>
|
||||||
<br/>Password: <strong>${password}</strong><br/><br/>
|
<p><strong>Mobile Number:</strong> ${phone}</p>
|
||||||
<a href="${process.env.PD_APP_URL}/login">Click here to login</a><br/><br/>
|
<p><strong>Email:</strong> ${email}</p>
|
||||||
If you have not requested this email, please ignore it.
|
<p><strong>Password:</strong> ${password}</p>
|
||||||
|
<br/>
|
||||||
|
<p>You can log in to your account using the following link:</p>
|
||||||
|
<p><a href=" https://pd.cnapp.co.in/#/login
|
||||||
|
" target="_blank" style="color: #0066cc; text-decoration: none;">Click here to log in</a></p>
|
||||||
|
<br/>
|
||||||
|
<p>For convenience, you can also download our mobile app from the following links:</p>
|
||||||
|
<ul>
|
||||||
|
<li><a href="https://drive.google.com/file/d/1GOpyyEwfbE0cMzvHHx0Fr7UOFzrQVIlp/view?usp=sharing
|
||||||
|
" target="_blank" style="color: #0066cc; text-decoration: none;">Download Mobile Application</a></li>
|
||||||
|
</ul>
|
||||||
|
<br/>
|
||||||
|
<p>If you have not requested this email or have any concerns, please contact our support team immediately.</p>
|
||||||
|
<br/>
|
||||||
|
<p>Best regards,</p>
|
||||||
|
<p><strong>Cheminova Support Team</strong></p>
|
||||||
`,
|
`,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -573,7 +603,9 @@ export const ResetPasswordAdmin = async (req, res) => {
|
|||||||
const user = await User.findById(id);
|
const user = await User.findById(id);
|
||||||
|
|
||||||
if (!user) {
|
if (!user) {
|
||||||
return res.status(404).json({ message: "Principal Distributor not found" });
|
return res
|
||||||
|
.status(404)
|
||||||
|
.json({ message: "Principal Distributor not found" });
|
||||||
}
|
}
|
||||||
|
|
||||||
// Generate a new random password
|
// Generate a new random password
|
||||||
@ -591,6 +623,7 @@ export const ResetPasswordAdmin = async (req, res) => {
|
|||||||
user.password = newPassword;
|
user.password = newPassword;
|
||||||
await user.save();
|
await user.save();
|
||||||
|
|
||||||
|
// Send email with the new credentials
|
||||||
// Send email with the new credentials
|
// Send email with the new credentials
|
||||||
await sendEmail({
|
await sendEmail({
|
||||||
to: `${user.email}`, // Recipient email
|
to: `${user.email}`, // Recipient email
|
||||||
@ -598,17 +631,26 @@ export const ResetPasswordAdmin = async (req, res) => {
|
|||||||
subject: "Cheminova Account Credentials",
|
subject: "Cheminova Account Credentials",
|
||||||
html: `
|
html: `
|
||||||
<p>Dear ${user.name},</p>
|
<p>Dear ${user.name},</p>
|
||||||
<p>Your account credentials have been updated. Please find your new login details below:</p>
|
<p>Your Principal Distributor account credentials have been updated. Please find your new login details below:</p>
|
||||||
<p><strong>Email:</strong> ${user.email}</p>
|
<p><strong>Email:</strong> ${user.email}</p>
|
||||||
<p><strong>Password:</strong> ${newPassword}</p>
|
<p><strong>Password:</strong> ${newPassword}</p>
|
||||||
<p>Please use these credentials to log in to your account. For security reasons, it's recommended to change your password after logging in.</p>
|
<p>Please use these credentials to log in to your account. For security reasons, it's recommended to change your password after logging in.</p>
|
||||||
<br/>
|
<br/>
|
||||||
|
<p>To log in via our website, please <a href="https://pd.cnapp.co.in/#/login
|
||||||
|
" target="_blank">click here</a>.</p>
|
||||||
|
<p>To download our mobile app, use the following links:</p>
|
||||||
|
<ul>
|
||||||
|
<li><a href="https://drive.google.com/file/d/1GOpyyEwfbE0cMzvHHx0Fr7UOFzrQVIlp/view?usp=sharing
|
||||||
|
" target="_blank">Download Mobile APplication</a></li>
|
||||||
|
</ul>
|
||||||
|
<br/>
|
||||||
<p>If you did not request this change, please contact our support team immediately.</p>
|
<p>If you did not request this change, please contact our support team immediately.</p>
|
||||||
<br/>
|
<br/>
|
||||||
<p>Best regards,</p>
|
<p>Best regards,</p>
|
||||||
<p>Cheminova Support Team</p>
|
<p>Cheminova Support Team</p>
|
||||||
`,
|
`,
|
||||||
});
|
});
|
||||||
|
|
||||||
// console.log(user);
|
// console.log(user);
|
||||||
res.status(200).json({
|
res.status(200).json({
|
||||||
success: true,
|
success: true,
|
||||||
|
Loading…
Reference in New Issue
Block a user