@schukai/monster 4.123.0 → 4.124.0

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/CHANGELOG.md CHANGED
@@ -2,6 +2,14 @@
2
2
 
3
3
 
4
4
 
5
+ ## [4.124.0] - 2026-02-20
6
+
7
+ ### Add Features
8
+
9
+ - Enhance login component with behavior options for password reset handling
10
+
11
+
12
+
5
13
  ## [4.123.0] - 2026-02-17
6
14
 
7
15
  ### Add Features
package/package.json CHANGED
@@ -1 +1 @@
1
- {"author":"Volker Schukai","dependencies":{"@floating-ui/dom":"^1.7.4","@popperjs/core":"^2.11.8"},"description":"Monster is a simple library for creating fast, robust and lightweight websites.","homepage":"https://monsterjs.org/","keywords":["framework","web","dom","css","sass","mobile-first","app","front-end","templates","schukai","core","shopcloud","alvine","monster","buildmap","stack","observer","observable","uuid","node","nodelist","css-in-js","logger","log","theme"],"license":"AGPL 3.0","main":"source/monster.mjs","module":"source/monster.mjs","name":"@schukai/monster","repository":{"type":"git","url":"https://gitlab.schukai.com/oss/libraries/javascript/monster.git"},"type":"module","version":"4.123.0"}
1
+ {"author":"Volker Schukai","dependencies":{"@floating-ui/dom":"^1.7.4","@popperjs/core":"^2.11.8"},"description":"Monster is a simple library for creating fast, robust and lightweight websites.","homepage":"https://monsterjs.org/","keywords":["framework","web","dom","css","sass","mobile-first","app","front-end","templates","schukai","core","shopcloud","alvine","monster","buildmap","stack","observer","observable","uuid","node","nodelist","css-in-js","logger","log","theme"],"license":"AGPL 3.0","main":"source/monster.mjs","module":"source/monster.mjs","name":"@schukai/monster","repository":{"type":"git","url":"https://gitlab.schukai.com/oss/libraries/javascript/monster.git"},"type":"module","version":"4.124.0"}
@@ -218,6 +218,8 @@ class Login extends CustomElement {
218
218
  * @property {Object} callbacks Optional callback hooks for modifying internal behavior
219
219
  * @property {Function} callbacks.username A function that receives and can transform the entered username before submission
220
220
  * @property {Function} callbacks.forgotPassword A function that receives and can transform the entered email before submission
221
+ * @property {Object} behavior Behavior options for response handling
222
+ * @property {number[]} behavior.passwordResetDisabledStatusCodes HTTP status codes that indicate reset is disabled
221
223
  * @property {number} digits Number of digits required for second factor or password reset code input
222
224
  * @property {Object[]} successUrls List of URLs shown after successful login (e.g., home or logout)
223
225
  * @property {string} successUrls.label Label for the success URL (displayed)
@@ -297,6 +299,10 @@ class Login extends CustomElement {
297
299
  forgotPassword: null,
298
300
  },
299
301
 
302
+ behavior: {
303
+ passwordResetDisabledStatusCodes: [401],
304
+ },
305
+
300
306
  digits: 6,
301
307
 
302
308
  successUrls: [
@@ -1484,35 +1490,37 @@ function initEventHandler() {
1484
1490
  getWindow()
1485
1491
  .fetch(url, options)
1486
1492
  .then((response) => {
1493
+ const disabledCodes =
1494
+ this.getOption("behavior.passwordResetDisabledStatusCodes") || [401];
1495
+ const isResetDisabled =
1496
+ disabledCodes.includes(response.status) &&
1497
+ response.headers.has("x-password-reset") &&
1498
+ response.headers.get("x-password-reset").includes("disabled");
1499
+
1487
1500
  if (response.ok) {
1488
1501
  const timeoutSuccess = this.getOption("timeoutForSuccess");
1489
1502
  this[requestLinkButtonSymbol].setState("successful", timeoutSuccess);
1490
1503
  setTimeout(() => {
1491
1504
  this.openDigits();
1492
1505
  }, timeoutSuccess);
1506
+ } else if (isResetDisabled) {
1507
+ this[requestLinkButtonSymbol].setMessage(
1508
+ this.getOption("labels.messagePasswordResetDisabled"),
1509
+ );
1510
+ } else if (response.status === 403) {
1511
+ this[requestLinkButtonSymbol].setMessage(
1512
+ this.getOption("labels.messageForbidden"),
1513
+ );
1514
+ } else if (response.status === 401) {
1515
+ this[requestLinkButtonSymbol].setMessage(
1516
+ this.getOption("labels.messageLoginFailed"),
1517
+ );
1493
1518
  } else {
1494
- if (response.status === 403) {
1495
- this[requestLinkButtonSymbol].setMessage(
1496
- this.getOption("labels.messageForbidden"),
1497
- );
1498
- } else if (response.status === 401) {
1499
- if (
1500
- response.headers.has("x-password-reset") &&
1501
- response.headers.get("x-password-reset").includes("disabled")
1502
- ) {
1503
- this[requestLinkButtonSymbol].setMessage(
1504
- this.getOption("labels.messagePasswordResetDisabled"),
1505
- );
1506
- } else {
1507
- this[requestLinkButtonSymbol].setMessage(
1508
- this.getOption("labels.messageLoginFailed"),
1509
- );
1510
- }
1511
- } else {
1512
- this[requestLinkButtonSymbol].setMessage(
1513
- this.getOption("labels.messageSomethingWentWrong"),
1514
- );
1515
- }
1519
+ this[requestLinkButtonSymbol].setMessage(
1520
+ this.getOption("labels.messageSomethingWentWrong"),
1521
+ );
1522
+ }
1523
+ if (!response.ok) {
1516
1524
  this[requestLinkButtonSymbol].showMessage(timeout);
1517
1525
  this[requestLinkButtonSymbol].setState("failed", timeout);
1518
1526
  }