ywana-core8 0.0.986 → 0.0.988

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.
@@ -173,18 +173,13 @@ var Session = {
173
173
  };
174
174
 
175
175
  function _extends() {
176
- _extends = Object.assign ? Object.assign.bind() : function (target) {
177
- for (var i = 1; i < arguments.length; i++) {
178
- var source = arguments[i];
179
- for (var key in source) {
180
- if (Object.prototype.hasOwnProperty.call(source, key)) {
181
- target[key] = source[key];
182
- }
183
- }
176
+ return _extends = Object.assign ? Object.assign.bind() : function (n) {
177
+ for (var e = 1; e < arguments.length; e++) {
178
+ var t = arguments[e];
179
+ for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]);
184
180
  }
185
- return target;
186
- };
187
- return _extends.apply(this, arguments);
181
+ return n;
182
+ }, _extends.apply(null, arguments);
188
183
  }
189
184
 
190
185
  /**
@@ -3039,6 +3034,51 @@ var LoginBox = function LoginBox(_ref) {
3039
3034
  }, /*#__PURE__*/React.createElement(Text, null, message)) : null));
3040
3035
  };
3041
3036
 
3037
+ function validatePassword(contraseña) {
3038
+ var error = "";
3039
+
3040
+ // Verificar longitud mínima y máxima
3041
+ if (contraseña.length < 15 || contraseña.length > 50) {
3042
+ error = 'La contraseña debe tener entre 15 y 50 caracteres.';
3043
+ return [false, error];
3044
+ }
3045
+
3046
+ // Verificar al menos una letra (mayúscula o minúscula)
3047
+ if (!/[A-Za-z]/.test(contraseña)) {
3048
+ error = 'La contraseña debe contener al menos una letra (A-Z o a-z).';
3049
+ return [false, error];
3050
+ }
3051
+
3052
+ // Verificar al menos un número
3053
+ if (!/[0-9]/.test(contraseña)) {
3054
+ error = 'La contraseña debe contener al menos un número (0-9).';
3055
+ return [false, error];
3056
+ }
3057
+
3058
+ // Verificar al menos una minúscula
3059
+ if (!/[a-z]/.test(contraseña)) {
3060
+ error = 'La contraseña debe contener al menos una letra en minúscula (a-z).';
3061
+ return [false, error];
3062
+ }
3063
+
3064
+ // Verificar al menos una mayúscula
3065
+ if (!/[A-Z]/.test(contraseña)) {
3066
+ error = 'La contraseña debe contener al menos una letra en mayúscula (A-Z).';
3067
+ return [false, error];
3068
+ }
3069
+
3070
+ // Verificar al menos un carácter especial
3071
+ if (!/[<>+&!?*\-_%\.:=]/.test(contraseña)) {
3072
+ error = 'La contraseña debe contener al menos un carácter especial (< > + & ! ? * - _ % . : =).';
3073
+ return [false, error];
3074
+ }
3075
+
3076
+ // Si todas las validaciones pasan
3077
+ return [true, error];
3078
+ }
3079
+
3080
+ //module.exports = { validatePassword }
3081
+
3042
3082
  /**
3043
3083
  * Reset Password
3044
3084
  */
@@ -3055,11 +3095,25 @@ var ResetPasswordBox = function ResetPasswordBox(_ref) {
3055
3095
  var _useState = useState({}),
3056
3096
  form = _useState[0],
3057
3097
  setForm = _useState[1];
3058
- var _useState2 = useState(),
3059
- error = _useState2[0],
3060
- setError = _useState2[1];
3061
- function canOK() {
3062
- return form.password1 && form.password2;
3098
+ var _useState2 = useState(false),
3099
+ isValid = _useState2[0],
3100
+ setIsValid = _useState2[1];
3101
+ var _useState3 = useState(),
3102
+ error = _useState3[0],
3103
+ setError = _useState3[1];
3104
+ useEffect(function () {
3105
+ setIsValid(validate());
3106
+ }, [form.password1, form.password2]);
3107
+ function validate() {
3108
+ var hasRequiredUser = userRequired ? form.user && form.user.length > 0 : true;
3109
+ var hasPassword1 = form.password1 && form.password1.length > 0;
3110
+ var _ref2 = hasPassword1 ? validatePassword(form.password1) : [false, "La contraseña es requerida."],
3111
+ isValid = _ref2[0],
3112
+ error = _ref2[1];
3113
+ setError(error);
3114
+ var areEqual = form.password1 === form.password2;
3115
+ if (isValid && !areEqual) setError("Las contraseñas no coinciden.");
3116
+ return hasRequiredUser && areEqual && isValid;
3063
3117
  }
3064
3118
  function changeField(id, value) {
3065
3119
  var _Object$assign;
@@ -3068,13 +3122,7 @@ var ResetPasswordBox = function ResetPasswordBox(_ref) {
3068
3122
  }
3069
3123
  function ok() {
3070
3124
  if (onOK && canOK()) {
3071
- if (form.password1 === form.password2) {
3072
- setError(null);
3073
- onOK(form);
3074
- } else {
3075
- var errorLabel = lang === "EN" ? "Passwords do not match" : "Las claves no coinciden";
3076
- setError(errorLabel);
3077
- }
3125
+ onOK(form);
3078
3126
  }
3079
3127
  }
3080
3128
  function close() {
@@ -3128,7 +3176,7 @@ var ResetPasswordBox = function ResetPasswordBox(_ref) {
3128
3176
  }), /*#__PURE__*/React.createElement(Button, {
3129
3177
  label: okLabel,
3130
3178
  raised: true,
3131
- disabled: !canOK(),
3179
+ disabled: !isValid,
3132
3180
  action: ok
3133
3181
  })));
3134
3182
  };
@@ -5471,6 +5519,7 @@ var TaskContextProvider = function TaskContextProvider(props) {
5471
5519
  listeners = _useState[0],
5472
5520
  setListeners = _useState[1];
5473
5521
  useEffect(function () {
5522
+ if (Object.keys(listeners).length === 0) return;
5474
5523
  var _interval = setInterval(function () {
5475
5524
  try {
5476
5525
  var taskIDs = Object.keys(listeners);
@@ -5491,12 +5540,12 @@ var TaskContextProvider = function TaskContextProvider(props) {
5491
5540
  };
5492
5541
  }, [listeners]);
5493
5542
  function addListener(taskID, listener) {
5494
- var next = Object.assign({}, listeners);
5495
- next[taskID] = listener;
5543
+ var _extends2;
5544
+ var next = _extends({}, listeners, (_extends2 = {}, _extends2[taskID] = listener, _extends2));
5496
5545
  setListeners(next);
5497
5546
  }
5498
5547
  function addListeners(newListeners) {
5499
- var next = Object.assign({}, listeners, newListeners);
5548
+ var next = _extends({}, listeners, newListeners);
5500
5549
  setListeners(next);
5501
5550
  }
5502
5551
  function removeListener(taskID) {
@@ -6060,7 +6109,7 @@ var PasswordEditor = function PasswordEditor(props) {
6060
6109
  site.closeDialog();
6061
6110
  }
6062
6111
  var openDialog = function openDialog() {
6063
- site.openDialog( /*#__PURE__*/React.createElement(ChangePasswordDialog, {
6112
+ site.openDialog(/*#__PURE__*/React.createElement(ChangePasswordDialog, {
6064
6113
  lang: lang,
6065
6114
  label: label,
6066
6115
  onOK: onOK,
@@ -6917,7 +6966,7 @@ var TableEditor$3 = function TableEditor(props) {
6917
6966
  }
6918
6967
  });
6919
6968
  }) : [];
6920
- if (canDelete) item.actions.push( /*#__PURE__*/React.createElement(Icon, {
6969
+ if (canDelete) item.actions.push(/*#__PURE__*/React.createElement(Icon, {
6921
6970
  icon: "delete",
6922
6971
  size: "small",
6923
6972
  clickable: true,
@@ -7527,7 +7576,7 @@ var CollectionPage$1 = function CollectionPage(props) {
7527
7576
  return Promise.reject(e);
7528
7577
  }
7529
7578
  };
7530
- site.openDialog( /*#__PURE__*/React.createElement(CreateContentDialog, {
7579
+ site.openDialog(/*#__PURE__*/React.createElement(CreateContentDialog, {
7531
7580
  label: "" + name,
7532
7581
  type: schema,
7533
7582
  onOK: onOK,
@@ -8400,7 +8449,7 @@ var TablePage = function TablePage(props) {
8400
8449
  return Promise.reject(e);
8401
8450
  }
8402
8451
  };
8403
- site.openDialog( /*#__PURE__*/React.createElement(CreateContentDialog, {
8452
+ site.openDialog(/*#__PURE__*/React.createElement(CreateContentDialog, {
8404
8453
  label: "Crear " + name,
8405
8454
  type: schema,
8406
8455
  onOK: onOK,
@@ -8423,7 +8472,7 @@ var TablePage = function TablePage(props) {
8423
8472
  return Promise.reject(e);
8424
8473
  }
8425
8474
  };
8426
- site.openDialog( /*#__PURE__*/React.createElement(CreateContentDialog, {
8475
+ site.openDialog(/*#__PURE__*/React.createElement(CreateContentDialog, {
8427
8476
  label: "Nueva query",
8428
8477
  type: QUERY,
8429
8478
  onOK: onOK
@@ -8911,7 +8960,7 @@ var TableEditor$2 = function TableEditor(props) {
8911
8960
  }
8912
8961
  });
8913
8962
  }) : [];
8914
- if (canDelete) item.actions.push( /*#__PURE__*/React.createElement(Icon, {
8963
+ if (canDelete) item.actions.push(/*#__PURE__*/React.createElement(Icon, {
8915
8964
  icon: "delete",
8916
8965
  size: "small",
8917
8966
  clickable: true,
@@ -9325,7 +9374,7 @@ var TablePage2 = function TablePage2(props) {
9325
9374
  return Promise.reject(e);
9326
9375
  }
9327
9376
  };
9328
- site.openDialog( /*#__PURE__*/React.createElement(CreateContentDialog, {
9377
+ site.openDialog(/*#__PURE__*/React.createElement(CreateContentDialog, {
9329
9378
  label: "Crear " + name,
9330
9379
  type: schema,
9331
9380
  onOK: onOK,
@@ -9347,7 +9396,7 @@ var TablePage2 = function TablePage2(props) {
9347
9396
  return Promise.reject(e);
9348
9397
  }
9349
9398
  };
9350
- site.openDialog( /*#__PURE__*/React.createElement(CreateContentDialog, {
9399
+ site.openDialog(/*#__PURE__*/React.createElement(CreateContentDialog, {
9351
9400
  label: "Nueva query",
9352
9401
  type: QUERY,
9353
9402
  onOK: onOK
@@ -9863,7 +9912,7 @@ var TableEditor$1 = function TableEditor(props) {
9863
9912
  }
9864
9913
  });
9865
9914
  }) : [];
9866
- if (canDelete) item.actions.push( /*#__PURE__*/React.createElement(Icon, {
9915
+ if (canDelete) item.actions.push(/*#__PURE__*/React.createElement(Icon, {
9867
9916
  icon: "delete",
9868
9917
  size: "small",
9869
9918
  clickable: true,
@@ -10325,7 +10374,7 @@ var TabbedTablePage = function TabbedTablePage(props) {
10325
10374
  return Promise.reject(e);
10326
10375
  }
10327
10376
  };
10328
- site.openDialog( /*#__PURE__*/React.createElement(CreateContentDialog, {
10377
+ site.openDialog(/*#__PURE__*/React.createElement(CreateContentDialog, {
10329
10378
  label: "Crear " + name,
10330
10379
  type: schema,
10331
10380
  onOK: onOK,
@@ -10347,7 +10396,7 @@ var TabbedTablePage = function TabbedTablePage(props) {
10347
10396
  return Promise.reject(e);
10348
10397
  }
10349
10398
  };
10350
- site.openDialog( /*#__PURE__*/React.createElement(CreateContentDialog, {
10399
+ site.openDialog(/*#__PURE__*/React.createElement(CreateContentDialog, {
10351
10400
  label: "Nueva query",
10352
10401
  type: QUERY,
10353
10402
  onOK: onOK
@@ -10847,7 +10896,7 @@ var TableEditor = function TableEditor(props) {
10847
10896
  }
10848
10897
  });
10849
10898
  }) : [];
10850
- if (canDelete) item.actions.push( /*#__PURE__*/React.createElement(Icon, {
10899
+ if (canDelete) item.actions.push(/*#__PURE__*/React.createElement(Icon, {
10851
10900
  icon: "delete",
10852
10901
  size: "small",
10853
10902
  clickable: true,