hide mail and otp function

This commit is contained in:
Sibunnayak 2024-07-15 13:12:00 +05:30
parent 0074536dc3
commit 6c55be42d9

View File

@ -26,7 +26,8 @@ export const register = async (req, res) => {
});
}
const otp = crypto.randomInt(100000, 1000000).toString();
// const otp = crypto.randomInt(100000, 1000000).toString();
const otp = "123456";
const otpExpires = Date.now() + 3 * 60 * 1000; // 3 minutes
if (salesCoordinator) {
@ -43,10 +44,10 @@ export const register = async (req, res) => {
}
await salesCoordinator.save();
await sendOtp(
fullMobileNumber,
`Your Cheminova verification OTP is: ${otp}`
);
// await sendOtp(
// fullMobileNumber,
// `Your Cheminova verification OTP is: ${otp}`
// );
return res.status(200).json({
message: `OTP sent to your mobile number ${fullMobileNumber} successfully`,
@ -77,8 +78,8 @@ export const verifyOtp = async (req, res) => {
) {
return res.status(400).json({ message: "Invalid or expired OTP" });
}
const name = salesCoordinator.name;
const mobile = salesCoordinator.mobileNumber;
// const name = salesCoordinator.name;
// const mobile = salesCoordinator.mobileNumber;
salesCoordinator.isVerified = true;
salesCoordinator.otp = undefined;
salesCoordinator.otpExpires = undefined;
@ -99,15 +100,15 @@ export const verifyOtp = async (req, res) => {
await salesCoordinator.save();
// Send email with the new password
await sendEmail({
to: `${salesCoordinator?.email}`, // Change to your recipient
from: `${process.env.SEND_EMAIL_FROM}`, // Change to your verified sender
subject: `Cheminova Account Created`,
html: `Your Account is created successfully.
<br/>name is: <strong>${name}</strong><br/>
<br/>MobileNumber is: <strong>${mobile}</strong><br/>
<br/>password is: <strong>${newPassword}</strong><br/><br/>If you have not requested this email, please ignore it.`,
});
// await sendEmail({
// to: `${salesCoordinator?.email}`, // Change to your recipient
// from: `${process.env.SEND_EMAIL_FROM}`, // Change to your verified sender
// subject: `Cheminova Account Created`,
// html: `Your Account is created successfully.
// <br/>name is: <strong>${name}</strong><br/>
// <br/>MobileNumber is: <strong>${mobile}</strong><br/>
// <br/>password is: <strong>${newPassword}</strong><br/><br/>If you have not requested this email, please ignore it.`,
// });
const token = salesCoordinator.getJWTToken();
res.status(200).json({
@ -309,7 +310,8 @@ export const updateMobileNumber = async (req, res) => {
if (existingSalesCoordinator) {
return res.status(400).json({ message: "Mobile number already registered and verified by someone" });
}
const otp = crypto.randomInt(100000, 1000000).toString();
// const otp = crypto.randomInt(100000, 1000000).toString();
const otp = "123456";
const otpExpires = Date.now() + 3 * 60 * 1000; // 3 minutes
salescoordinator.newMobileNumber = newFullMobileNumber;