Test ip
This commit is contained in:
@@ -55,6 +55,7 @@ module.exports.login_with_pass = [
|
|||||||
const token = await jwt.sign({ _id: user._id }, secretKey, {
|
const token = await jwt.sign({ _id: user._id }, secretKey, {
|
||||||
expiresIn: req.body.remember_me ? '30d' : '7d'
|
expiresIn: req.body.remember_me ? '30d' : '7d'
|
||||||
})
|
})
|
||||||
|
user.ip = req.ip
|
||||||
user.token = token
|
user.token = token
|
||||||
await user.save()
|
await user.save()
|
||||||
await Notification.create({
|
await Notification.create({
|
||||||
@@ -95,6 +96,7 @@ module.exports.login_with_otp = [
|
|||||||
expiresIn: req.body.remember_me ? '30d' : '7d'
|
expiresIn: req.body.remember_me ? '30d' : '7d'
|
||||||
})
|
})
|
||||||
user.otp = generateRandomDigits(6)
|
user.otp = generateRandomDigits(6)
|
||||||
|
user.ip = req.ip
|
||||||
user.save()
|
user.save()
|
||||||
await Notification.create({
|
await Notification.create({
|
||||||
userID:user._id,
|
userID:user._id,
|
||||||
|
|||||||
@@ -27,6 +27,7 @@ const UserSchema = mongoose.Schema({
|
|||||||
},
|
},
|
||||||
shopName: String,
|
shopName: String,
|
||||||
birthDate: String,
|
birthDate: String,
|
||||||
|
lastIP:String,
|
||||||
walletBalance: {
|
walletBalance: {
|
||||||
type: Number,
|
type: Number,
|
||||||
min: 0,
|
min: 0,
|
||||||
|
|||||||
Reference in New Issue
Block a user