aloux-iam 0.0.73 → 0.0.75
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/Menu.js +13 -12
- package/lib/services/auth.js +14 -5
- package/package.json +1 -1
package/lib/models/Menu.js
CHANGED
|
@@ -1,16 +1,17 @@
|
|
|
1
|
-
const mongoose = require(
|
|
1
|
+
const mongoose = require("mongoose");
|
|
2
2
|
|
|
3
3
|
const menuSchema = mongoose.Schema({
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
4
|
+
label: { type: String, required: true, trim: true },
|
|
5
|
+
description: { type: String, required: false, trim: true },
|
|
6
|
+
path: { type: String, required: true, trim: true },
|
|
7
|
+
icon: { type: String, required: false, trim: true },
|
|
8
|
+
index: { type: Number },
|
|
9
|
+
_menu: { type: mongoose.Schema.Types.ObjectId, ref: "Menu" },
|
|
9
10
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
})
|
|
11
|
+
status: { type: String, required: true, enum: ["Activo", "Inactivo"] },
|
|
12
|
+
createdAt: { type: Number },
|
|
13
|
+
lastUpdate: { type: Number },
|
|
14
|
+
});
|
|
14
15
|
|
|
15
|
-
const Menu = mongoose.model("Menu", menuSchema)
|
|
16
|
-
module.exports = Menu
|
|
16
|
+
const Menu = mongoose.model("Menu", menuSchema);
|
|
17
|
+
module.exports = Menu;
|
package/lib/services/auth.js
CHANGED
|
@@ -95,12 +95,21 @@ self.login = async (body, res) => {
|
|
|
95
95
|
|
|
96
96
|
else {
|
|
97
97
|
const token = await userLogin.generateAuthToken()
|
|
98
|
-
|
|
99
|
-
userLogin
|
|
100
|
-
|
|
101
|
-
|
|
98
|
+
let changePwd
|
|
99
|
+
if(!userLogin?.data){
|
|
100
|
+
userLogin.data = {}
|
|
101
|
+
userLogin.data.changePwd = false
|
|
102
|
+
changePwd= false
|
|
103
|
+
await userLogin.save()
|
|
104
|
+
|
|
105
|
+
}else if( !userLogin?.data?.changePwd ){
|
|
106
|
+
userLogin.data.changePwd = false
|
|
107
|
+
changePwd= false
|
|
108
|
+
await userLogin.save()
|
|
109
|
+
}else{
|
|
110
|
+
changePwd = userLogin.data.changePwd
|
|
111
|
+
}
|
|
102
112
|
|
|
103
|
-
|
|
104
113
|
res.cookie("token", token, {
|
|
105
114
|
secure: true,
|
|
106
115
|
httpOnly: true,
|