scheduler-node-models 1.2.120 → 1.2.122

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "scheduler-node-models",
3
- "version": "1.2.120",
3
+ "version": "1.2.122",
4
4
  "main": "index.js",
5
5
  "types": "index.d.ts",
6
6
  "files": [
@@ -19,6 +19,7 @@ export declare class Workday implements IWorkday {
19
19
  workcenter: string;
20
20
  code: string;
21
21
  hours: number;
22
+ date?: Date;
22
23
  constructor(wd?: IWorkday);
23
24
  /**
24
25
  * This function is used to sort two workday objects based on the workday's identifier.
@@ -13,6 +13,7 @@ class Workday {
13
13
  workcenter;
14
14
  code;
15
15
  hours;
16
+ date;
16
17
  constructor(wd) {
17
18
  this.id = (wd) ? wd.id : 0;
18
19
  this.workcenter = (wd) ? wd.workcenter : '';
@@ -26,22 +26,4 @@ export declare class SecurityQuestion implements ISecurityQuestion {
26
26
  * or after (1)
27
27
  */
28
28
  compareTo(other?: SecurityQuestion): number;
29
- /**
30
- * This function is used to update either the question or answer which
31
- * is provided in the value. If the field is answer, the value is
32
- * saved encrypted of its lower case equivalent.
33
- * @param field A string value to indicate which object field is to be updated
34
- * @param value A string value for the update.
35
- */
36
- update(field: string, value: string): void;
37
- /**
38
- * This function will check a provided answer, during reset, with the
39
- * answer in this object. It will submit a lower case value for checking
40
- * because the answer is orginally the lower case value of the provided
41
- * answer.
42
- * @param value A string value used during comparision.
43
- * @returns A boolean value for whether or not the given value is equal to
44
- * the saved value.
45
- */
46
- compare(value: string): boolean;
47
29
  }
package/users/question.js CHANGED
@@ -1,7 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.SecurityQuestion = void 0;
4
- const bcrypt_ts_1 = require("bcrypt-ts");
5
4
  /**
6
5
  * This class defines a security question object, which implements the
7
6
  * security question interface of question and answer. It also includes
@@ -33,36 +32,5 @@ class SecurityQuestion {
33
32
  }
34
33
  return -1;
35
34
  }
36
- /**
37
- * This function is used to update either the question or answer which
38
- * is provided in the value. If the field is answer, the value is
39
- * saved encrypted of its lower case equivalent.
40
- * @param field A string value to indicate which object field is to be updated
41
- * @param value A string value for the update.
42
- */
43
- update(field, value) {
44
- switch (field.toLowerCase()) {
45
- case "question":
46
- this.question = value;
47
- break;
48
- case "answer":
49
- const salt = (0, bcrypt_ts_1.genSaltSync)(12);
50
- const result = (0, bcrypt_ts_1.hashSync)(value.toLowerCase(), salt);
51
- this.answer = result;
52
- break;
53
- }
54
- }
55
- /**
56
- * This function will check a provided answer, during reset, with the
57
- * answer in this object. It will submit a lower case value for checking
58
- * because the answer is orginally the lower case value of the provided
59
- * answer.
60
- * @param value A string value used during comparision.
61
- * @returns A boolean value for whether or not the given value is equal to
62
- * the saved value.
63
- */
64
- compare(value) {
65
- return (0, bcrypt_ts_1.compareSync)(value.toLowerCase(), this.answer);
66
- }
67
35
  }
68
36
  exports.SecurityQuestion = SecurityQuestion;
package/users/user.d.ts CHANGED
@@ -70,24 +70,6 @@ export declare class User implements IUser {
70
70
  * @returns A new User interface for passing
71
71
  */
72
72
  cloneForOutput(): IUser;
73
- /**
74
- * This function will reset the password, bad attemtps and expiration date. The new
75
- * password will be excrypted for storage.
76
- * @param passwd The string value for the new password
77
- */
78
- setPassword(passwd: string): void;
79
- /**
80
- * This function will be used in authentication to verify if the password provided is
81
- * equivelent to the stored one.
82
- * @param pwd The string value to compare against the encrypted password.
83
- * @throws An error if the account is locked or there is a mismatch with the password.
84
- */
85
- checkPassword(pwd: string): void;
86
- /**
87
- * This function will provide a random 16 character password.
88
- * @returns A string value representing the new random password.
89
- */
90
- createRandomPassword(): string;
91
73
  /**
92
74
  * This function will unlock the user account to allow for access.
93
75
  */
@@ -133,23 +115,6 @@ export declare class User implements IUser {
133
115
  * @param email The string value for the email to remove.
134
116
  */
135
117
  deleteAdditionalEmail(email: string): void;
136
- /**
137
- * This function will update a security question question or answer
138
- * based on the identifier, field and value provided.
139
- * @param id A numeric value for the identifier of the question.
140
- * @param field A string value for the field (question or answer) to be
141
- * updated.
142
- * @param value A string value for the updated value for the field.
143
- */
144
- updateSecurityQuestion(id: number, field: string, value: string): void;
145
- /**
146
- * This function is used to check the response for a security question
147
- * answer to the stored value.
148
- * @param id A numeric value for the question to check against.
149
- * @param value A string value for the answer to the question.
150
- * @returns A boolean value for whether the answers match.
151
- */
152
- checkSecurityQuestion(id: number, value: string): boolean;
153
118
  /**
154
119
  * This function will be used to look to ensure the user has a particular job/permission
155
120
  * for an application. All checks are done with lower case strings.
package/users/user.js CHANGED
@@ -1,7 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.User = void 0;
4
- const bcrypt_ts_1 = require("bcrypt-ts");
5
4
  const question_1 = require("./question");
6
5
  const permission_1 = require("./permission");
7
6
  /**
@@ -132,53 +131,6 @@ class User {
132
131
  output.resettokenexp = undefined;
133
132
  return output;
134
133
  }
135
- /**
136
- * This function will reset the password, bad attemtps and expiration date. The new
137
- * password will be excrypted for storage.
138
- * @param passwd The string value for the new password
139
- */
140
- setPassword(passwd) {
141
- const salt = (0, bcrypt_ts_1.genSaltSync)(12);
142
- const result = (0, bcrypt_ts_1.hashSync)(passwd, salt);
143
- this.password = result;
144
- this.passwordExpires = new Date();
145
- this.badAttempts = 0;
146
- }
147
- /**
148
- * This function will be used in authentication to verify if the password provided is
149
- * equivelent to the stored one.
150
- * @param pwd The string value to compare against the encrypted password.
151
- * @throws An error if the account is locked or there is a mismatch with the password.
152
- */
153
- checkPassword(pwd) {
154
- if (this.password && (0, bcrypt_ts_1.compareSync)(pwd, this.password)) {
155
- if (this.badAttempts > 2) {
156
- throw new Error("Account Locked");
157
- }
158
- this.badAttempts = 0;
159
- return;
160
- }
161
- else {
162
- this.badAttempts++;
163
- throw new Error("Account Mismatch");
164
- }
165
- }
166
- /**
167
- * This function will provide a random 16 character password.
168
- * @returns A string value representing the new random password.
169
- */
170
- createRandomPassword() {
171
- let result = '';
172
- const characters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz'
173
- + '0123456789';
174
- const charLength = characters.length;
175
- for (let i = 0; i < 16; i++) {
176
- result += characters.charAt(Math.floor(Math.random() * charLength));
177
- }
178
- this.setPassword(result);
179
- this.badAttempts = -1;
180
- return result;
181
- }
182
134
  /**
183
135
  * This function will unlock the user account to allow for access.
184
136
  */
@@ -284,38 +236,6 @@ class User {
284
236
  this.additionalEmails.splice(found, 1);
285
237
  }
286
238
  }
287
- /**
288
- * This function will update a security question question or answer
289
- * based on the identifier, field and value provided.
290
- * @param id A numeric value for the identifier of the question.
291
- * @param field A string value for the field (question or answer) to be
292
- * updated.
293
- * @param value A string value for the updated value for the field.
294
- */
295
- updateSecurityQuestion(id, field, value) {
296
- this.questions.forEach((quest, i) => {
297
- if (quest.id === id) {
298
- quest.update(field, value);
299
- this.questions[i] = quest;
300
- }
301
- });
302
- }
303
- /**
304
- * This function is used to check the response for a security question
305
- * answer to the stored value.
306
- * @param id A numeric value for the question to check against.
307
- * @param value A string value for the answer to the question.
308
- * @returns A boolean value for whether the answers match.
309
- */
310
- checkSecurityQuestion(id, value) {
311
- let answer = false;
312
- this.questions.forEach(quest => {
313
- if (quest.id === id) {
314
- answer = quest.compare(value);
315
- }
316
- });
317
- return answer;
318
- }
319
239
  /**
320
240
  * This function will be used to look to ensure the user has a particular job/permission
321
241
  * for an application. All checks are done with lower case strings.