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.
@@ -1,16 +1,17 @@
1
- const mongoose = require('mongoose')
1
+ const mongoose = require("mongoose");
2
2
 
3
3
  const menuSchema = mongoose.Schema({
4
- label: { type: String, required: true, trim: true },
5
- path: { type: String, required: true, trim: true },
6
- icon: { type: String, required: true, trim: true },
7
- index: { type: Number },
8
- _menu: { type: mongoose.Schema.Types.ObjectId, ref: 'Menu' },
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
- status: { type: String, required: true, enum: ['Activo','Inactivo'] },
11
- createdAt: { type: Number },
12
- lastUpdate: { type: Number }
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;
@@ -95,12 +95,21 @@ self.login = async (body, res) => {
95
95
 
96
96
  else {
97
97
  const token = await userLogin.generateAuthToken()
98
- const changePwd = userLogin?.data?.changePwd === true ? true : false
99
- userLogin.data.changePwd = changePwd
100
- await userLogin.save()
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,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "aloux-iam",
3
- "version": "0.0.73",
3
+ "version": "0.0.75",
4
4
  "description": "Aloux IAM for APIs ",
5
5
  "main": "index.js",
6
6
  "scripts": {