This commit is contained in:
pawan-dot 2024-07-01 13:33:54 +05:30
parent b560d3a324
commit d4b4c1341d
2 changed files with 5 additions and 10 deletions

View File

@ -30,14 +30,9 @@ export default sendEmail;
// } // }
// export default sendEmail // export default sendEmail
// from message bird send mail------------------------------------ // from message bird SMS send------------------------------------
// messageSender.js
// import messagebird from "messagebird";
// const apiKey = "7oOgyzfNuwBnqMc2oK6aGfczs";
// const messagebirdClient = messagebird(apiKey);
import { initClient } from "messagebird"; import { initClient } from "messagebird";
const messagebird = initClient("e7HGr3kMl6su4c79DKjNAwlLQ"); const messagebird = initClient("p2YaqxU9uYx2F3d3dV8ywAFtk");
// e7HGr3kMl6su4c79DKjNAwlLQ // e7HGr3kMl6su4c79DKjNAwlLQ
//7oOgyzfNuwBnqMc2oK6aGfczs //7oOgyzfNuwBnqMc2oK6aGfczs
//11yKY8EbdFJpugJzaKyAH3YaK //11yKY8EbdFJpugJzaKyAH3YaK
@ -48,7 +43,7 @@ export const sendOtp = async (recipient, message) => {
return; return;
} }
const params = { const params = {
originator: "tavisa", originator: "+447418314922",
recipients: [recipient], recipients: [recipient],
body: message, body: message,
}; };

View File

@ -26,14 +26,14 @@ export const register = async (req, res) => {
patient = new Patient({ name, mobileNumber: fullMobileNumber, otp, otpExpires }); patient = new Patient({ name, mobileNumber: fullMobileNumber, otp, otpExpires });
} }
await patient.save(); await patient.save();
await sendOtp(fullMobileNumber, `Your Verification OTP is: ${otp}`); await sendOtp(fullMobileNumber, `Your tavisa verification OTP is: ${otp}`);
res.cookie('patientId', patient._id.toString(), res.cookie('patientId', patient._id.toString(),
{ httpOnly: true } { httpOnly: true }
); // 1 day in milliseconds ); // 1 day in milliseconds
// { httpOnly: true, maxAge: 24 * 60 * 60 * 1000 } // { httpOnly: true, maxAge: 24 * 60 * 60 * 1000 }
return res.status(200).json({ patient, message: `OTP ${otp} sent to your mobile number ${fullMobileNumber} successfully` }); return res.status(200).json({ patient, message: `OTP sent to your mobile number ${fullMobileNumber} successfully` });
} catch (error) { } catch (error) {
res.status(500).json({ res.status(500).json({
message: error.message ? error.message : "Server error!", message: error.message ? error.message : "Server error!",