add otp form

This commit is contained in:
Hamidreza Eidy
2024-11-18 10:48:19 +00:00
parent d887cf67c1
commit 94500faf79
3 changed files with 77 additions and 9 deletions
+1 -1
View File
@@ -165,11 +165,11 @@ module.exports.otp = [
// .withMessage(_sr["fa"].min_char.min4),
],
async (req, res) => {
console.log('body', req.body)
try {
const errors = validationResult(req);
if (!errors.isEmpty())
return res.status(422).json({ validation: errors.mapped() });
const { phone } = req.body;
const user = await User.findOne({ mobileNumber: phone });
if (!user)