aloux-iam 0.0.76 → 0.0.78

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -22,7 +22,10 @@ const adminSchema = mongoose.Schema({
22
22
  regionCode: { type: String, trim: true, maxLength: 10 }
23
23
  },
24
24
  urlImg: { type: String },
25
- data: { type: Object },
25
+ data: {
26
+ type: Object,
27
+ default: { changePwd: false }
28
+ },
26
29
  validateKey: {
27
30
  limitCodeTime: { type: Number },
28
31
  resetPassword: {
@@ -97,7 +97,6 @@ self.login = async (body, res) => {
97
97
  const token = await userLogin.generateAuthToken()
98
98
  let changePwd
99
99
  if(!userLogin?.data){
100
- userLogin.data = {}
101
100
  userLogin.data.changePwd = false
102
101
  changePwd= false
103
102
  await userLogin.save()
@@ -408,7 +407,7 @@ self.resetPassword = async (req, res) => {
408
407
  var body = JSON.parse(JSON.stringify(req.body))
409
408
  let usuario = await User.findOne({ email: correo })
410
409
 
411
- if (!usuario) {
410
+ if (!usuario || !usuario?.data?.changePwd ) { //evaluar si se queda
412
411
  throw { code: 409, title: 'Usuario no encontrado.', detail: '', suggestion: 'Verifica que el usuario exista', error: new Error() }
413
412
  }
414
413
 
@@ -608,6 +607,7 @@ self.createCustomer = async (req, res) => {
608
607
  }
609
608
  user._functions.push(fun._id)
610
609
  delete user.pwd
610
+ user.data.changePwd = false
611
611
  let newCustomer = await user.save()
612
612
  await UserProvisional.deleteOne({email: newCustomer.email})
613
613
  const token = await newCustomer.generateAuthToken()
@@ -21,7 +21,7 @@ self.create = async (body) => {
21
21
  user.status = body?.status ? body?.status : 'Activo'
22
22
 
23
23
  delete user.pwd
24
-
24
+ user.data.changePwd = false
25
25
  await user.save()
26
26
 
27
27
  return user
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "aloux-iam",
3
- "version": "0.0.76",
3
+ "version": "0.0.78",
4
4
  "description": "Aloux IAM for APIs ",
5
5
  "main": "index.js",
6
6
  "scripts": {