@everymatrix/pam-change-password 1.74.7 → 1.74.8

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/dist/esm/index.js CHANGED
@@ -1,2 +1,2 @@
1
- export { P as PamChangePassword } from './pam-change-password-0b043d09.js';
1
+ export { P as PamChangePassword } from './pam-change-password-af5033a0.js';
2
2
  import './index-13661b98.js';
@@ -14,7 +14,14 @@ const TRANSLATIONS = {
14
14
  "successMsg": "Password changed successfully",
15
15
  "errorMsgGeneric": "There was an error when attempting to change your password",
16
16
  "gm.pms.password_not_verified_unauthorized": "The current password you have entered is incorrect",
17
- "gm.pms.password_policy_failed": "Password cannot be the same as any of the {forbiddenLastPasswordsCount} previous passwords. Password cannot be changed sooner than {minimumPasswordAgeLimitHours} {hours} after the last change."
17
+ "gm.pms.password_policy_failed": "Password cannot be the same as any of the {forbiddenLastPasswordsCount} previous passwords. Password cannot be changed sooner than {minimumPasswordAgeLimitHours} {hours} after the last change.",
18
+ "passwordContainsFirstName": "Password should not contain your first name.",
19
+ "passwordContainsLastName": "Password should not contain your last name.",
20
+ "passwordContainsUsername": "Password should not contain your username.",
21
+ "passwordContainsEmail": "Password should not contain your email.",
22
+ "passwordContainsFirstNamePlusLastName": "Password should not contain first name + last name.",
23
+ "passwordContainsFirstNameAndLastName": "Password should not contain first name and last name.",
24
+ "passwordContainsDateOfBirth": "Password should not contain date of birth."
18
25
  },
19
26
  "fr": {
20
27
  "title": "Changer le mot de passe",
@@ -28,7 +35,14 @@ const TRANSLATIONS = {
28
35
  "successMsg": "Mot de passe changé avec succès",
29
36
  "errorMsgGeneric": "Une erreur est survenue lors de la tentative de changement de mot de passe",
30
37
  "gm.pms.password_not_verified_unauthorized": "Le mot de passe actuel que vous avez entré est incorrect",
31
- "gm.pms.password_policy_failed": "Le mot de passe ne peut pas être identique à l'un des {forbiddenLastPasswordsCount} derniers mots de passe. Le mot de passe ne peut pas être changé avant {minimumPasswordAgeLimitHours} {hours} après le dernier changement."
38
+ "gm.pms.password_policy_failed": "Le mot de passe ne peut pas être identique à l'un des {forbiddenLastPasswordsCount} derniers mots de passe. Le mot de passe ne peut pas être changé avant {minimumPasswordAgeLimitHours} {hours} après le dernier changement.",
39
+ "passwordContainsFirstName": "Password should not contain your first name.",
40
+ "passwordContainsLastName": "Password should not contain your last name.",
41
+ "passwordContainsUsername": "Password should not contain your username.",
42
+ "passwordContainsEmail": "Password should not contain your email.",
43
+ "passwordContainsFirstNamePlusLastName": "Password should not contain first name + last name.",
44
+ "passwordContainsFirstNameAndLastName": "Password should not contain first name and last name.",
45
+ "passwordContainsDateOfBirth": "Password should not contain date of birth."
32
46
  },
33
47
  "ro": {
34
48
  "title": "Schimbă Parola",
@@ -42,7 +56,14 @@ const TRANSLATIONS = {
42
56
  "successMsg": "Parola a fost schimbată cu succes",
43
57
  "errorMsgGeneric": "A apărut o eroare la încercarea de schimbare a parolei",
44
58
  "gm.pms.password_not_verified_unauthorized": "Parola curentă introdusă este incorectă",
45
- "gm.pms.password_policy_failed": "Parola nu poate fi aceeași cu oricare dintre ultimele {forbiddenLastPasswordsCount} parole. Parola nu poate fi schimbată mai devreme de {minimumPasswordAgeLimitHours} {hours} după ultima schimbare."
59
+ "gm.pms.password_policy_failed": "Parola nu poate fi aceeași cu oricare dintre ultimele {forbiddenLastPasswordsCount} parole. Parola nu poate fi schimbată mai devreme de {minimumPasswordAgeLimitHours} {hours} după ultima schimbare.",
60
+ "passwordContainsFirstName": "Password should not contain your first name.",
61
+ "passwordContainsLastName": "Password should not contain your last name.",
62
+ "passwordContainsUsername": "Password should not contain your username.",
63
+ "passwordContainsEmail": "Password should not contain your email.",
64
+ "passwordContainsFirstNamePlusLastName": "Password should not contain first name + last name.",
65
+ "passwordContainsFirstNameAndLastName": "Password should not contain first name and last name.",
66
+ "passwordContainsDateOfBirth": "Password should not contain date of birth."
46
67
  },
47
68
  "es": {
48
69
  "title": "Cambiar Contraseña",
@@ -56,7 +77,14 @@ const TRANSLATIONS = {
56
77
  "successMsg": "Contraseña cambiada con éxito",
57
78
  "errorMsgGeneric": "Hubo un error al intentar cambiar tu contraseña",
58
79
  "gm.pms.password_not_verified_unauthorized": "La contraseña actual que has introducido es incorrecta",
59
- "gm.pms.password_policy_failed": "La contraseña no puede ser la misma que cualquiera de las {forbiddenLastPasswordsCount} contraseñas anteriores. La contraseña no se puede cambiar antes de {minimumPasswordAgeLimitHours} {hours} después del último cambio."
80
+ "gm.pms.password_policy_failed": "La contraseña no puede ser la misma que cualquiera de las {forbiddenLastPasswordsCount} contraseñas anteriores. La contraseña no se puede cambiar antes de {minimumPasswordAgeLimitHours} {hours} después del último cambio.",
81
+ "passwordContainsFirstName": "Password should not contain your first name.",
82
+ "passwordContainsLastName": "Password should not contain your last name.",
83
+ "passwordContainsUsername": "Password should not contain your username.",
84
+ "passwordContainsEmail": "Password should not contain your email.",
85
+ "passwordContainsFirstNamePlusLastName": "Password should not contain first name + last name.",
86
+ "passwordContainsFirstNameAndLastName": "Password should not contain first name and last name.",
87
+ "passwordContainsDateOfBirth": "Password should not contain date of birth."
60
88
  },
61
89
  "pt": {
62
90
  "title": "Alterar Senha",
@@ -70,7 +98,14 @@ const TRANSLATIONS = {
70
98
  "successMsg": "Senha alterada com sucesso",
71
99
  "errorMsgGeneric": "Ocorreu um erro ao tentar alterar sua senha",
72
100
  "gm.pms.password_not_verified_unauthorized": "A senha atual que você inseriu está incorreta",
73
- "gm.pms.password_policy_failed": "A senha não pode ser a mesma que qualquer uma das últimas {forbiddenLastPasswordsCount} senhas. A senha não pode ser alterada antes de {minimumPasswordAgeLimitHours} {hours} após a última alteração."
101
+ "gm.pms.password_policy_failed": "A senha não pode ser a mesma que qualquer uma das últimas {forbiddenLastPasswordsCount} senhas. A senha não pode ser alterada antes de {minimumPasswordAgeLimitHours} {hours} após a última alteração.",
102
+ "passwordContainsFirstName": "Password should not contain your first name.",
103
+ "passwordContainsLastName": "Password should not contain your last name.",
104
+ "passwordContainsUsername": "Password should not contain your username.",
105
+ "passwordContainsEmail": "Password should not contain your email.",
106
+ "passwordContainsFirstNamePlusLastName": "Password should not contain first name + last name.",
107
+ "passwordContainsFirstNameAndLastName": "Password should not contain first name and last name.",
108
+ "passwordContainsDateOfBirth": "Password should not contain date of birth."
74
109
  },
75
110
  "hr": {
76
111
  "title": "Promijeni lozinku",
@@ -84,7 +119,14 @@ const TRANSLATIONS = {
84
119
  "successMsg": "Lozinka je uspješno promijenjena",
85
120
  "errorMsgGeneric": "Došlo je do pogreške prilikom pokušaja promjene lozinke",
86
121
  "gm.pms.password_not_verified_unauthorized": "Unesena trenutna lozinka nije ispravna",
87
- "gm.pms.password_policy_failed": "Lozinka ne može biti ista kao bilo koja od posljednjih {forbiddenLastPasswordsCount} lozinki. Lozinka se ne može promijeniti prije nego što prođe {minimumPasswordAgeLimitHours} {hours} od posljednje promjene."
122
+ "gm.pms.password_policy_failed": "Lozinka ne može biti ista kao bilo koja od posljednjih {forbiddenLastPasswordsCount} lozinki. Lozinka se ne može promijeniti prije nego što prođe {minimumPasswordAgeLimitHours} {hours} od posljednje promjene.",
123
+ "passwordContainsFirstName": "Password should not contain your first name.",
124
+ "passwordContainsLastName": "Password should not contain your last name.",
125
+ "passwordContainsUsername": "Password should not contain your username.",
126
+ "passwordContainsEmail": "Password should not contain your email.",
127
+ "passwordContainsFirstNamePlusLastName": "Password should not contain first name + last name.",
128
+ "passwordContainsFirstNameAndLastName": "Password should not contain first name and last name.",
129
+ "passwordContainsDateOfBirth": "Password should not contain date of birth."
88
130
  },
89
131
  "tr": {
90
132
  "title": "Şifreyi Değiştir",
@@ -98,7 +140,14 @@ const TRANSLATIONS = {
98
140
  "successMsg": "Şifre başarıyla değiştirildi",
99
141
  "errorMsgGeneric": "Şifrenizi değiştirirken bir hata oluştu",
100
142
  "gm.pms.password_not_verified_unauthorized": "Girdiğiniz mevcut şifre yanlış",
101
- "gm.pms.password_policy_failed": "Şifre, son {forbiddenLastPasswordsCount} şifreden herhangi biriyle aynı olamaz. Şifre, son değişiklikten sonra {minimumPasswordAgeLimitHours} {hours} içinde değiştirilemez."
143
+ "gm.pms.password_policy_failed": "Şifre, son {forbiddenLastPasswordsCount} şifreden herhangi biriyle aynı olamaz. Şifre, son değişiklikten sonra {minimumPasswordAgeLimitHours} {hours} içinde değiştirilemez.",
144
+ "passwordContainsFirstName": "Password should not contain your first name.",
145
+ "passwordContainsLastName": "Password should not contain your last name.",
146
+ "passwordContainsUsername": "Password should not contain your username.",
147
+ "passwordContainsEmail": "Password should not contain your email.",
148
+ "passwordContainsFirstNamePlusLastName": "Password should not contain first name + last name.",
149
+ "passwordContainsFirstNameAndLastName": "Password should not contain first name and last name.",
150
+ "passwordContainsDateOfBirth": "Password should not contain date of birth."
102
151
  },
103
152
  "hu": {
104
153
  "title": "Jelszó megváltoztatása",
@@ -112,7 +161,14 @@ const TRANSLATIONS = {
112
161
  "successMsg": "A jelszó sikeresen megváltozott",
113
162
  "errorMsgGeneric": "Hiba történt a jelszó megváltoztatásakor",
114
163
  "gm.pms.password_not_verified_unauthorized": "A megadott jelenlegi jelszó helytelen",
115
- "gm.pms.password_policy_failed": "A jelszó nem egyezhet meg az utolsó {forbiddenLastPasswordsCount} jelszóval. A jelszó nem változtatható meg {minimumPasswordAgeLimitHours} {hours}-on belül az utolsó módosítás óta."
164
+ "gm.pms.password_policy_failed": "A jelszó nem egyezhet meg az utolsó {forbiddenLastPasswordsCount} jelszóval. A jelszó nem változtatható meg {minimumPasswordAgeLimitHours} {hours}-on belül az utolsó módosítás óta.",
165
+ "passwordContainsFirstName": "Password should not contain your first name.",
166
+ "passwordContainsLastName": "Password should not contain your last name.",
167
+ "passwordContainsUsername": "Password should not contain your username.",
168
+ "passwordContainsEmail": "Password should not contain your email.",
169
+ "passwordContainsFirstNamePlusLastName": "Password should not contain first name + last name.",
170
+ "passwordContainsFirstNameAndLastName": "Password should not contain first name and last name.",
171
+ "passwordContainsDateOfBirth": "Password should not contain date of birth."
116
172
  }
117
173
  };
118
174
  const getTranslations = (url) => {
@@ -255,15 +311,35 @@ const PamChangePassword = class {
255
311
  custom: this.policy.customValidationRules
256
312
  };
257
313
  };
258
- this.setErrorMsg = (key) => {
314
+ this.setErrorMsg = (key, response) => {
315
+ var _a, _b, _c;
259
316
  switch (key) {
260
317
  case 'gm.pms.password_policy_failed':
261
- const values = {
262
- forbiddenLastPasswordsCount: this.policy.forbiddenLastPasswordsCount,
263
- minimumPasswordAgeLimitHours: this.policy.minimumPasswordAgeLimitHours,
264
- hours: this.policy.minimumPasswordAgeLimitHours > 1 ? 'hours' : 'hour'
265
- };
266
- this.errorMsg = translate(key, this.language, { values: values });
318
+ if (((_b = (_a = response === null || response === void 0 ? void 0 : response.errors) === null || _a === void 0 ? void 0 : _a.policy) === null || _b === void 0 ? void 0 : _b.length) > 0) {
319
+ const values = {
320
+ forbiddenLastPasswordsCount: this.policy.forbiddenLastPasswordsCount,
321
+ minimumPasswordAgeLimitHours: this.policy.minimumPasswordAgeLimitHours,
322
+ hours: this.policy.minimumPasswordAgeLimitHours > 1 ? 'hours' : 'hour'
323
+ };
324
+ this.errorMsg = translate(key, this.language, { values: values });
325
+ }
326
+ else if (((_c = response === null || response === void 0 ? void 0 : response.errors) === null || _c === void 0 ? void 0 : _c.strength) && Array.isArray(response.errors.strength)) {
327
+ //translate each specific error message
328
+ const translatedErrors = response.errors.strength.map((error) => {
329
+ const errorKeyMap = {
330
+ 'Password should not contain first name.': 'passwordContainsFirstName',
331
+ 'Password should not contain last name.': 'passwordContainsLastName',
332
+ 'Password should not contain username.': 'passwordContainsUsername',
333
+ 'Password should not contain email.': 'passwordContainsEmail',
334
+ 'Password should not contain first name + last name.': 'passwordContainsFirstNamePlusLastName',
335
+ 'Password should not contain first name and last name.': 'passwordContainsFirstNameAndLastName',
336
+ 'Password should not contain date of birth.': 'passwordContainsDateOfBirth',
337
+ };
338
+ const translationKey = errorKeyMap[error] || null;
339
+ return translationKey ? translate(translationKey, this.language) : error;
340
+ });
341
+ this.errorMsg = translatedErrors.join(' ');
342
+ }
267
343
  break;
268
344
  case 'gm.pms.password_not_verified_unauthorized':
269
345
  this.errorMsg = translate(key, this.language);
@@ -328,7 +404,7 @@ const PamChangePassword = class {
328
404
  window.postMessage({ type: 'WidgetNotification', data: { type: 'success', message: translate('successMsg', this.language) } }, window.location.href);
329
405
  }
330
406
  else {
331
- this.setErrorMsg(res.message);
407
+ this.setErrorMsg(res.message, res);
332
408
  window.postMessage({ type: 'WidgetNotification', data: { type: 'error', message: this.errorMsg } }, window.location.href);
333
409
  }
334
410
  })