hide mail and otp function
This commit is contained in:
parent
0074536dc3
commit
6c55be42d9
@ -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
|
const otpExpires = Date.now() + 3 * 60 * 1000; // 3 minutes
|
||||||
|
|
||||||
if (salesCoordinator) {
|
if (salesCoordinator) {
|
||||||
@ -43,10 +44,10 @@ export const register = async (req, res) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
await salesCoordinator.save();
|
await salesCoordinator.save();
|
||||||
await sendOtp(
|
// await sendOtp(
|
||||||
fullMobileNumber,
|
// fullMobileNumber,
|
||||||
`Your Cheminova verification OTP is: ${otp}`
|
// `Your Cheminova verification OTP is: ${otp}`
|
||||||
);
|
// );
|
||||||
|
|
||||||
return res.status(200).json({
|
return res.status(200).json({
|
||||||
message: `OTP sent to your mobile number ${fullMobileNumber} successfully`,
|
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" });
|
return res.status(400).json({ message: "Invalid or expired OTP" });
|
||||||
}
|
}
|
||||||
const name = salesCoordinator.name;
|
// const name = salesCoordinator.name;
|
||||||
const mobile = salesCoordinator.mobileNumber;
|
// const mobile = salesCoordinator.mobileNumber;
|
||||||
salesCoordinator.isVerified = true;
|
salesCoordinator.isVerified = true;
|
||||||
salesCoordinator.otp = undefined;
|
salesCoordinator.otp = undefined;
|
||||||
salesCoordinator.otpExpires = undefined;
|
salesCoordinator.otpExpires = undefined;
|
||||||
@ -99,15 +100,15 @@ export const verifyOtp = async (req, res) => {
|
|||||||
await salesCoordinator.save();
|
await salesCoordinator.save();
|
||||||
|
|
||||||
// Send email with the new password
|
// Send email with the new password
|
||||||
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: `Cheminova Account Created`,
|
||||||
html: `Your Account is created successfully.
|
// html: `Your Account is created successfully.
|
||||||
<br/>name is: <strong>${name}</strong><br/>
|
// <br/>name is: <strong>${name}</strong><br/>
|
||||||
<br/>MobileNumber is: <strong>${mobile}</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.`,
|
// <br/>password is: <strong>${newPassword}</strong><br/><br/>If you have not requested this email, please ignore it.`,
|
||||||
});
|
// });
|
||||||
|
|
||||||
const token = salesCoordinator.getJWTToken();
|
const token = salesCoordinator.getJWTToken();
|
||||||
res.status(200).json({
|
res.status(200).json({
|
||||||
@ -309,7 +310,8 @@ export const updateMobileNumber = async (req, res) => {
|
|||||||
if (existingSalesCoordinator) {
|
if (existingSalesCoordinator) {
|
||||||
return res.status(400).json({ message: "Mobile number already registered and verified by someone" });
|
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
|
const otpExpires = Date.now() + 3 * 60 * 1000; // 3 minutes
|
||||||
|
|
||||||
salescoordinator.newMobileNumber = newFullMobileNumber;
|
salescoordinator.newMobileNumber = newFullMobileNumber;
|
||||||
|
Loading…
Reference in New Issue
Block a user