OTP generator sending to email
Closed this issue · 0 comments
GansukhB commented
/common/generators.js файлд
async function generateOtp(){
// 6 оронтой тоо үүсгэх
return XXXXX; //үүсгэсэн 6 оронтой тоог буцаана.
}
async function generateOtpForUser(userId){
const opt = await generateOtp()
//UserOpt моделийг ашиглан userotp collection-д
await UserOtp.create({
userId: userId,
otp: otp
}); // байдлаар хадгална
return otp; //
}
/endpoints/services/userRegister.js дээр
const text = "text"; // Generated OTP must be sent
мөр дэх текстийг
"Сайн байна уу? Таны нэг удаагийн нэвтрэх нууц код: XXXXXX"
форматтай болгоно.