Add full project files

This commit is contained in:
root
2026-07-04 19:24:56 +03:30
parent d54f5441a3
commit b245e7b71a
835 changed files with 30149 additions and 0 deletions

16
utils/otpExpiry.js Normal file
View File

@@ -0,0 +1,16 @@
const OTP_VALID_MS = 5 * 60 * 1000
const isOtpExpired = (user) => {
if (!user?.otp) return true
if (!user?.otpSentAt) return false
return Date.now() - new Date(user.otpSentAt).getTime() > OTP_VALID_MS
}
const clearOtp = (UserModel, mobile) =>
UserModel.updateOne({ mobile }, { $set: { otp: null, otpSentAt: null } })
module.exports = {
OTP_VALID_MS,
isOtpExpired,
clearOtp
}