update: add shafafiat pages

This commit is contained in:
mahyargdz
2024-11-19 14:01:47 +03:30
parent 1c89bc5f08
commit 256924dd3a
15 changed files with 329 additions and 26 deletions
+3 -2
View File
@@ -165,7 +165,7 @@ module.exports.otp = [
// .withMessage(_sr["fa"].min_char.min4),
],
async (req, res) => {
console.log('body', req.body)
console.log("body", req.body);
try {
const errors = validationResult(req);
if (!errors.isEmpty())
@@ -183,6 +183,7 @@ module.exports.otp = [
ttl: (cacheService.getTtl(`OTP:LOGIN:${phone}`) - Date.now()) / 1000,
});
const otp = crypto.randomInt(10000, 99999);
console.log("==> otp :", otp);
const message = `کد ورود شما ${otp} میباشد. استانداری لغو11`;
/** save otp in cache */
cacheService.set(`OTP:LOGIN:${phone}`, otp, 120);
@@ -264,7 +265,7 @@ module.exports.verifyOtp = [
if (logger) {
await Logger.findOneAndUpdate(
{ user: user._id },
{ $set: { LastLogin: new Date() } },
{ $set: { LastLogin: new Date(), ip: req.ip } },
{ new: true }
);
} else {