otp
This commit is contained in:
parent
b560d3a324
commit
d4b4c1341d
@ -30,14 +30,9 @@ export default sendEmail;
|
||||
// }
|
||||
// export default sendEmail
|
||||
|
||||
// from message bird send mail------------------------------------
|
||||
// messageSender.js
|
||||
// import messagebird from "messagebird";
|
||||
|
||||
// const apiKey = "7oOgyzfNuwBnqMc2oK6aGfczs";
|
||||
// const messagebirdClient = messagebird(apiKey);
|
||||
// from message bird SMS send------------------------------------
|
||||
import { initClient } from "messagebird";
|
||||
const messagebird = initClient("e7HGr3kMl6su4c79DKjNAwlLQ");
|
||||
const messagebird = initClient("p2YaqxU9uYx2F3d3dV8ywAFtk");
|
||||
// e7HGr3kMl6su4c79DKjNAwlLQ
|
||||
//7oOgyzfNuwBnqMc2oK6aGfczs
|
||||
//11yKY8EbdFJpugJzaKyAH3YaK
|
||||
@ -48,7 +43,7 @@ export const sendOtp = async (recipient, message) => {
|
||||
return;
|
||||
}
|
||||
const params = {
|
||||
originator: "tavisa",
|
||||
originator: "+447418314922",
|
||||
recipients: [recipient],
|
||||
body: message,
|
||||
};
|
||||
|
@ -26,14 +26,14 @@ export const register = async (req, res) => {
|
||||
patient = new Patient({ name, mobileNumber: fullMobileNumber, otp, otpExpires });
|
||||
}
|
||||
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(),
|
||||
{ httpOnly: true }
|
||||
); // 1 day in milliseconds
|
||||
// { 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) {
|
||||
res.status(500).json({
|
||||
message: error.message ? error.message : "Server error!",
|
||||
|
Loading…
Reference in New Issue
Block a user