asv-hlps 1.4.25 → 1.4.27
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/cjs/users/user.js +38 -6
- package/lib/cjs/utils.d.ts +1 -0
- package/lib/cjs/utils.js +5 -1
- package/lib/esm/users/user.js +5 -6
- package/lib/esm/utils.d.ts +1 -0
- package/lib/esm/utils.js +3 -0
- package/package.json +2 -1
package/lib/cjs/users/user.js
CHANGED
|
@@ -1,13 +1,45 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
2
35
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
36
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
37
|
};
|
|
5
38
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
39
|
exports.getSteShortname = exports.labelSteName = exports.userCoef = exports.userGrpCode = exports.secureUserPassword = exports.secureUser = exports.entryDesignationUser = exports.getFullname = exports.isStaffSte = exports.isBillPeriod = exports.hasRole = exports.inSteGrp = exports.displaySteOrFullname = exports.displaySteOrStaff = exports.inGrp = void 0;
|
|
7
|
-
|
|
40
|
+
const bcrypt = __importStar(require("bcryptjs"));
|
|
8
41
|
const randomatic_1 = __importDefault(require("randomatic"));
|
|
9
42
|
const utils_1 = require("../utils");
|
|
10
|
-
const crypto = require("crypto-js");
|
|
11
43
|
// export const inGrp = (grps: string[], user: User | UserNotarial) => {
|
|
12
44
|
const inGrp = (grps, user) => {
|
|
13
45
|
return [...grps].includes(user.grp.code.toLowerCase()) ? true : false;
|
|
@@ -88,8 +120,8 @@ const secureUser = (user, username, heads) => {
|
|
|
88
120
|
user.password = (0, randomatic_1.default)("Aa0", 8);
|
|
89
121
|
user.dns = heads.host;
|
|
90
122
|
user.clp = user.password;
|
|
91
|
-
|
|
92
|
-
user.password = crypto.hashSync(user.password, 8);
|
|
123
|
+
user.password = bcrypt.hashSync(user.password, 8);
|
|
124
|
+
// user.password = crypto.hashSync(user.password, 8);
|
|
93
125
|
user.username = username;
|
|
94
126
|
};
|
|
95
127
|
exports.secureUser = secureUser;
|
|
@@ -99,8 +131,8 @@ const secureUserPassword = (user, heads) => {
|
|
|
99
131
|
user.dns = heads.host;
|
|
100
132
|
}
|
|
101
133
|
user.clp = user.password;
|
|
102
|
-
|
|
103
|
-
user.password = crypto.hashSync(user.password, 8);
|
|
134
|
+
user.password = bcrypt.hashSync(user.password, 8);
|
|
135
|
+
// user.password = crypto.hashSync(user.password, 8);
|
|
104
136
|
};
|
|
105
137
|
exports.secureUserPassword = secureUserPassword;
|
|
106
138
|
const userGrpCode = (user) => {
|
package/lib/cjs/utils.d.ts
CHANGED
|
@@ -110,3 +110,4 @@ export declare const toggleProp: (tob: any, propToToggle: string) => any;
|
|
|
110
110
|
export declare const winMaxHeight: (step?: 0.2 | 0.3 | 0.4 | 0.5 | 0.6 | 0.7 | 0.8 | 0.9) => number;
|
|
111
111
|
export declare const arraySome: (arr1: any[], arr2: any[]) => boolean;
|
|
112
112
|
export declare const checkObjInArray: (objs: any[], checkProp: string | number, prop?: string) => boolean;
|
|
113
|
+
export declare const pathUrlName: (location: Location) => string;
|
package/lib/cjs/utils.js
CHANGED
|
@@ -4,7 +4,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.inputChecked = exports.arrayMultiChecked = exports.getPeriodDateColor = exports.getColorAccordingToDate = exports.genRandomColour = exports.formatNgbDate = exports.getNbOfDaysBetweenTwoDates = exports.displayDateRangeFr = exports.reformatDates = exports.firstDayOfDate = exports.dateToString = exports.dateDiff = exports.dateNthWeek = exports.getNthWeek = exports.dateFormatter = exports.replaceSpacesWith = exports.replaceAllIn = exports.toPlural = exports.sesStorageGet = exports.sesStorageSet = exports.genSequenceRef = exports.refGenerator = exports.removeBackSlashOccurences = exports.stringifyFormatter = exports.removeString = exports.diffArraysByProp = exports.diffArraysByFunc = exports.deepClone = exports.findFirstSequenceMissing = exports.fillNumWithZero = exports.findSequencesMissing = exports.sequencesToNumbers = exports.notInSequence = exports.currencyFormatterCfa = exports.currencyFormatter = exports.checkAuth = exports.wakeUp = exports.sleep = exports.limitTo = exports.titleCase = exports.toObjectDate = exports.duplicateObjects = exports.removeDuplicateValues = exports.removeDuplicateObjects = exports.getRandomColor = exports.calPercent = exports.percentOf = exports.genDateMinutesStep = exports.formatDateFirstDayFr = exports.isEmpty = void 0;
|
|
7
|
-
exports.checkObjInArray = exports.arraySome = exports.winMaxHeight = exports.toggleProp = exports.roundLastNDigits = exports.removeParamKeyName = exports.countryIsoToFlag = exports.monthStringName = exports.returnBool = exports.formatAmountToString = exports.reduceTimes = exports.reduceSum = exports.sumAmount = exports.fillEndWithZero = exports.fillStartWithZero = exports.absFromSequence = exports.returnDates = exports.displayFrDatePeriode = exports.getArrayOfRandomColor = exports.randomHslColor = exports.randomHexColor = exports.genRandomNumberArray = exports.randomRgbColor = exports.randomInteger = exports.insertAtInArray = exports.isBirthday = exports.padEndWithZero = exports.padStartWithZero = exports.formatMonthYearToLocaleString = exports.calculPercent = exports.validEmail = exports.convertToCfa = exports.packAndUnit = exports.unCheckedAll = void 0;
|
|
7
|
+
exports.pathUrlName = exports.checkObjInArray = exports.arraySome = exports.winMaxHeight = exports.toggleProp = exports.roundLastNDigits = exports.removeParamKeyName = exports.countryIsoToFlag = exports.monthStringName = exports.returnBool = exports.formatAmountToString = exports.reduceTimes = exports.reduceSum = exports.sumAmount = exports.fillEndWithZero = exports.fillStartWithZero = exports.absFromSequence = exports.returnDates = exports.displayFrDatePeriode = exports.getArrayOfRandomColor = exports.randomHslColor = exports.randomHexColor = exports.genRandomNumberArray = exports.randomRgbColor = exports.randomInteger = exports.insertAtInArray = exports.isBirthday = exports.padEndWithZero = exports.padStartWithZero = exports.formatMonthYearToLocaleString = exports.calculPercent = exports.validEmail = exports.convertToCfa = exports.packAndUnit = exports.unCheckedAll = void 0;
|
|
8
8
|
const dayjs_1 = __importDefault(require("dayjs"));
|
|
9
9
|
const isSameOrBefore_1 = __importDefault(require("dayjs/plugin/isSameOrBefore"));
|
|
10
10
|
const relativeTime_1 = __importDefault(require("dayjs/plugin/relativeTime"));
|
|
@@ -796,3 +796,7 @@ const checkObjInArray = (objs, checkProp, prop = "id") => {
|
|
|
796
796
|
});
|
|
797
797
|
};
|
|
798
798
|
exports.checkObjInArray = checkObjInArray;
|
|
799
|
+
const pathUrlName = (location) => {
|
|
800
|
+
return location.pathname.substring(location.pathname.lastIndexOf("/") + 1);
|
|
801
|
+
};
|
|
802
|
+
exports.pathUrlName = pathUrlName;
|
package/lib/esm/users/user.js
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
|
|
1
|
+
import * as bcrypt from "bcryptjs";
|
|
2
2
|
import randomatic from "randomatic";
|
|
3
3
|
import { limitTo, titleCase } from "../utils";
|
|
4
|
-
const crypto = require("crypto-js");
|
|
5
4
|
// export const inGrp = (grps: string[], user: User | UserNotarial) => {
|
|
6
5
|
export const inGrp = (grps, user) => {
|
|
7
6
|
return [...grps].includes(user.grp.code.toLowerCase()) ? true : false;
|
|
@@ -73,8 +72,8 @@ export const secureUser = (user, username, heads) => {
|
|
|
73
72
|
user.password = randomatic("Aa0", 8);
|
|
74
73
|
user.dns = heads.host;
|
|
75
74
|
user.clp = user.password;
|
|
76
|
-
|
|
77
|
-
user.password = crypto.hashSync(user.password, 8);
|
|
75
|
+
user.password = bcrypt.hashSync(user.password, 8);
|
|
76
|
+
// user.password = crypto.hashSync(user.password, 8);
|
|
78
77
|
user.username = username;
|
|
79
78
|
};
|
|
80
79
|
export const secureUserPassword = (user, heads) => {
|
|
@@ -83,8 +82,8 @@ export const secureUserPassword = (user, heads) => {
|
|
|
83
82
|
user.dns = heads.host;
|
|
84
83
|
}
|
|
85
84
|
user.clp = user.password;
|
|
86
|
-
|
|
87
|
-
user.password = crypto.hashSync(user.password, 8);
|
|
85
|
+
user.password = bcrypt.hashSync(user.password, 8);
|
|
86
|
+
// user.password = crypto.hashSync(user.password, 8);
|
|
88
87
|
};
|
|
89
88
|
export const userGrpCode = (user) => {
|
|
90
89
|
return user.grp.code.toLowerCase() === "st" ? user.ste.grp.code.toLowerCase() : user.grp.code.toLowerCase();
|
package/lib/esm/utils.d.ts
CHANGED
|
@@ -110,3 +110,4 @@ export declare const toggleProp: (tob: any, propToToggle: string) => any;
|
|
|
110
110
|
export declare const winMaxHeight: (step?: 0.2 | 0.3 | 0.4 | 0.5 | 0.6 | 0.7 | 0.8 | 0.9) => number;
|
|
111
111
|
export declare const arraySome: (arr1: any[], arr2: any[]) => boolean;
|
|
112
112
|
export declare const checkObjInArray: (objs: any[], checkProp: string | number, prop?: string) => boolean;
|
|
113
|
+
export declare const pathUrlName: (location: Location) => string;
|
package/lib/esm/utils.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "asv-hlps",
|
|
3
|
-
"version": "1.4.
|
|
3
|
+
"version": "1.4.27",
|
|
4
4
|
"description": "helpers",
|
|
5
5
|
"main": "./lib/cjs/index.js",
|
|
6
6
|
"module": "./lib/esm/index.js",
|
|
@@ -25,6 +25,7 @@
|
|
|
25
25
|
},
|
|
26
26
|
"dependencies": {
|
|
27
27
|
"axios": "^1.8.4",
|
|
28
|
+
"bcryptjs": "^3.0.2",
|
|
28
29
|
"class-validator": "^0.14.1",
|
|
29
30
|
"classnames": "^2.5.1",
|
|
30
31
|
"dayjs": "^1.11.13",
|