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.
- package/lib/models/User.js +4 -1
- package/lib/services/auth.js +2 -2
- package/lib/services/user.js +1 -1
- package/package.json +1 -1
package/lib/models/User.js
CHANGED
|
@@ -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: {
|
|
25
|
+
data: {
|
|
26
|
+
type: Object,
|
|
27
|
+
default: { changePwd: false }
|
|
28
|
+
},
|
|
26
29
|
validateKey: {
|
|
27
30
|
limitCodeTime: { type: Number },
|
|
28
31
|
resetPassword: {
|
package/lib/services/auth.js
CHANGED
|
@@ -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()
|
package/lib/services/user.js
CHANGED