asv-hlps 1.4.16 → 1.4.18

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,45 +1,13 @@
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
- })();
35
2
  var __importDefault = (this && this.__importDefault) || function (mod) {
36
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
37
4
  };
38
5
  Object.defineProperty(exports, "__esModule", { value: true });
39
6
  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;
40
- const bcrypt = __importStar(require("bcryptjs"));
7
+ // import * as bcrypt from "bcryptjs";
41
8
  const randomatic_1 = __importDefault(require("randomatic"));
42
9
  const utils_1 = require("../utils");
10
+ const crypto = require("crypto-js");
43
11
  // export const inGrp = (grps: string[], user: User | UserNotarial) => {
44
12
  const inGrp = (grps, user) => {
45
13
  return [...grps].includes(user.grp.code.toLowerCase()) ? true : false;
@@ -120,7 +88,8 @@ const secureUser = (user, username, heads) => {
120
88
  user.password = (0, randomatic_1.default)("Aa0", 8);
121
89
  user.dns = heads.host;
122
90
  user.clp = user.password;
123
- user.password = bcrypt.hashSync(user.password, 8);
91
+ // user.password = bcrypt.hashSync(user.password, 8);
92
+ user.password = crypto.hashSync(user.password, 8);
124
93
  user.username = username;
125
94
  };
126
95
  exports.secureUser = secureUser;
@@ -130,7 +99,8 @@ const secureUserPassword = (user, heads) => {
130
99
  user.dns = heads.host;
131
100
  }
132
101
  user.clp = user.password;
133
- user.password = bcrypt.hashSync(user.password, 8);
102
+ // user.password = bcrypt.hashSync(user.password, 8);
103
+ user.password = crypto.hashSync(user.password, 8);
134
104
  };
135
105
  exports.secureUserPassword = secureUserPassword;
136
106
  const userGrpCode = (user) => {
@@ -1,6 +1,7 @@
1
- import * as bcrypt from "bcryptjs";
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");
4
5
  // export const inGrp = (grps: string[], user: User | UserNotarial) => {
5
6
  export const inGrp = (grps, user) => {
6
7
  return [...grps].includes(user.grp.code.toLowerCase()) ? true : false;
@@ -72,7 +73,8 @@ export const secureUser = (user, username, heads) => {
72
73
  user.password = randomatic("Aa0", 8);
73
74
  user.dns = heads.host;
74
75
  user.clp = user.password;
75
- user.password = bcrypt.hashSync(user.password, 8);
76
+ // user.password = bcrypt.hashSync(user.password, 8);
77
+ user.password = crypto.hashSync(user.password, 8);
76
78
  user.username = username;
77
79
  };
78
80
  export const secureUserPassword = (user, heads) => {
@@ -81,7 +83,8 @@ export const secureUserPassword = (user, heads) => {
81
83
  user.dns = heads.host;
82
84
  }
83
85
  user.clp = user.password;
84
- user.password = bcrypt.hashSync(user.password, 8);
86
+ // user.password = bcrypt.hashSync(user.password, 8);
87
+ user.password = crypto.hashSync(user.password, 8);
85
88
  };
86
89
  export const userGrpCode = (user) => {
87
90
  return user.grp.code.toLowerCase() === "st" ? user.ste.grp.code.toLowerCase() : user.grp.code.toLowerCase();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "asv-hlps",
3
- "version": "1.4.16",
3
+ "version": "1.4.18",
4
4
  "description": "helpers",
5
5
  "main": "./lib/cjs/index.js",
6
6
  "module": "./lib/esm/index.js",
@@ -16,7 +16,6 @@
16
16
  "author": "Aril Vignon",
17
17
  "license": "ISC",
18
18
  "devDependencies": {
19
- "@types/bcryptjs": "^2.4.6",
20
19
  "@types/express": "^5.0.0",
21
20
  "@types/jwt-decode": "^3.1.0",
22
21
  "@types/lodash": "^4.17.16",
@@ -26,7 +25,6 @@
26
25
  },
27
26
  "dependencies": {
28
27
  "axios": "^1.8.2",
29
- "bcryptjs": "^3.0.2",
30
28
  "class-validator": "^0.14.1",
31
29
  "classnames": "^2.5.1",
32
30
  "dayjs": "^1.11.13",