ywana-core8 0.0.987 → 0.0.989
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/index.cjs +92 -41
- package/dist/index.cjs.map +1 -1
- package/dist/index.modern.js +92 -41
- package/dist/index.modern.js.map +1 -1
- package/dist/index.umd.js +92 -41
- package/dist/index.umd.js.map +1 -1
- package/package.json +4 -2
- package/src/incubator/task.js +8 -6
- package/src/widgets/login/ResetPasswordBox.js +17 -12
- package/src/widgets/login/ResetPasswordBoxTest.js +24 -0
- package/src/widgets/login/login_commons.js +45 -0
- package/src/widgets/login/login_commons.test.js +51 -0
package/dist/index.umd.js
CHANGED
@@ -175,18 +175,13 @@
|
|
175
175
|
};
|
176
176
|
|
177
177
|
function _extends() {
|
178
|
-
_extends = Object.assign ? Object.assign.bind() : function (
|
179
|
-
for (var
|
180
|
-
var
|
181
|
-
for (var
|
182
|
-
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
183
|
-
target[key] = source[key];
|
184
|
-
}
|
185
|
-
}
|
178
|
+
return _extends = Object.assign ? Object.assign.bind() : function (n) {
|
179
|
+
for (var e = 1; e < arguments.length; e++) {
|
180
|
+
var t = arguments[e];
|
181
|
+
for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]);
|
186
182
|
}
|
187
|
-
return
|
188
|
-
};
|
189
|
-
return _extends.apply(this, arguments);
|
183
|
+
return n;
|
184
|
+
}, _extends.apply(null, arguments);
|
190
185
|
}
|
191
186
|
|
192
187
|
/**
|
@@ -3041,6 +3036,51 @@
|
|
3041
3036
|
}, /*#__PURE__*/React__default["default"].createElement(Text, null, message)) : null));
|
3042
3037
|
};
|
3043
3038
|
|
3039
|
+
function validatePassword(contraseña) {
|
3040
|
+
var error = "";
|
3041
|
+
|
3042
|
+
// Verificar longitud mínima y máxima
|
3043
|
+
if (contraseña.length < 15 || contraseña.length > 50) {
|
3044
|
+
error = 'La contraseña debe tener entre 15 y 50 caracteres.';
|
3045
|
+
return [false, error];
|
3046
|
+
}
|
3047
|
+
|
3048
|
+
// Verificar al menos una letra (mayúscula o minúscula)
|
3049
|
+
if (!/[A-Za-z]/.test(contraseña)) {
|
3050
|
+
error = 'La contraseña debe contener al menos una letra (A-Z o a-z).';
|
3051
|
+
return [false, error];
|
3052
|
+
}
|
3053
|
+
|
3054
|
+
// Verificar al menos un número
|
3055
|
+
if (!/[0-9]/.test(contraseña)) {
|
3056
|
+
error = 'La contraseña debe contener al menos un número (0-9).';
|
3057
|
+
return [false, error];
|
3058
|
+
}
|
3059
|
+
|
3060
|
+
// Verificar al menos una minúscula
|
3061
|
+
if (!/[a-z]/.test(contraseña)) {
|
3062
|
+
error = 'La contraseña debe contener al menos una letra en minúscula (a-z).';
|
3063
|
+
return [false, error];
|
3064
|
+
}
|
3065
|
+
|
3066
|
+
// Verificar al menos una mayúscula
|
3067
|
+
if (!/[A-Z]/.test(contraseña)) {
|
3068
|
+
error = 'La contraseña debe contener al menos una letra en mayúscula (A-Z).';
|
3069
|
+
return [false, error];
|
3070
|
+
}
|
3071
|
+
|
3072
|
+
// Verificar al menos un carácter especial
|
3073
|
+
if (!/[<>+&!?*\-_%\.:=]/.test(contraseña)) {
|
3074
|
+
error = 'La contraseña debe contener al menos un carácter especial (< > + & ! ? * - _ % . : =).';
|
3075
|
+
return [false, error];
|
3076
|
+
}
|
3077
|
+
|
3078
|
+
// Si todas las validaciones pasan
|
3079
|
+
return [true, error];
|
3080
|
+
}
|
3081
|
+
|
3082
|
+
//module.exports = { validatePassword }
|
3083
|
+
|
3044
3084
|
/**
|
3045
3085
|
* Reset Password
|
3046
3086
|
*/
|
@@ -3057,11 +3097,25 @@
|
|
3057
3097
|
var _useState = React.useState({}),
|
3058
3098
|
form = _useState[0],
|
3059
3099
|
setForm = _useState[1];
|
3060
|
-
var _useState2 = React.useState(),
|
3061
|
-
|
3062
|
-
|
3063
|
-
|
3064
|
-
|
3100
|
+
var _useState2 = React.useState(false),
|
3101
|
+
isValid = _useState2[0],
|
3102
|
+
setIsValid = _useState2[1];
|
3103
|
+
var _useState3 = React.useState(),
|
3104
|
+
error = _useState3[0],
|
3105
|
+
setError = _useState3[1];
|
3106
|
+
React.useEffect(function () {
|
3107
|
+
setIsValid(validate());
|
3108
|
+
}, [form.password1, form.password2]);
|
3109
|
+
function validate() {
|
3110
|
+
var hasRequiredUser = userRequired ? form.user && form.user.length > 0 : true;
|
3111
|
+
var hasPassword1 = form.password1 && form.password1.length > 0;
|
3112
|
+
var _ref2 = hasPassword1 ? validatePassword(form.password1) : [false, "La contraseña es requerida."],
|
3113
|
+
isValid = _ref2[0],
|
3114
|
+
error = _ref2[1];
|
3115
|
+
setError(error);
|
3116
|
+
var areEqual = form.password1 === form.password2;
|
3117
|
+
if (isValid && !areEqual) setError("Las contraseñas no coinciden.");
|
3118
|
+
return hasRequiredUser && areEqual && isValid;
|
3065
3119
|
}
|
3066
3120
|
function changeField(id, value) {
|
3067
3121
|
var _Object$assign;
|
@@ -3070,13 +3124,7 @@
|
|
3070
3124
|
}
|
3071
3125
|
function ok() {
|
3072
3126
|
if (onOK && canOK()) {
|
3073
|
-
|
3074
|
-
setError(null);
|
3075
|
-
onOK(form);
|
3076
|
-
} else {
|
3077
|
-
var errorLabel = lang === "EN" ? "Passwords do not match" : "Las claves no coinciden";
|
3078
|
-
setError(errorLabel);
|
3079
|
-
}
|
3127
|
+
onOK(form);
|
3080
3128
|
}
|
3081
3129
|
}
|
3082
3130
|
function close() {
|
@@ -3130,7 +3178,7 @@
|
|
3130
3178
|
}), /*#__PURE__*/React__default["default"].createElement(Button, {
|
3131
3179
|
label: okLabel,
|
3132
3180
|
raised: true,
|
3133
|
-
disabled: !
|
3181
|
+
disabled: !isValid,
|
3134
3182
|
action: ok
|
3135
3183
|
})));
|
3136
3184
|
};
|
@@ -5467,12 +5515,15 @@
|
|
5467
5515
|
url = _props$url === void 0 ? "/tasks" : _props$url,
|
5468
5516
|
_props$frequency = props.frequency,
|
5469
5517
|
frequency = _props$frequency === void 0 ? 1000 : _props$frequency,
|
5470
|
-
children = props.children
|
5518
|
+
children = props.children,
|
5519
|
+
ctx = props.ctx;
|
5471
5520
|
var API = CollectionAPI$1(url, host, "");
|
5472
5521
|
var _useState = React.useState({}),
|
5473
5522
|
listeners = _useState[0],
|
5474
5523
|
setListeners = _useState[1];
|
5524
|
+
var appContext = React.useContext(ctx);
|
5475
5525
|
React.useEffect(function () {
|
5526
|
+
if (Object.keys(listeners).length === 0) return;
|
5476
5527
|
var _interval = setInterval(function () {
|
5477
5528
|
try {
|
5478
5529
|
var taskIDs = Object.keys(listeners);
|
@@ -5480,7 +5531,7 @@
|
|
5480
5531
|
var taskID = taskIDs[i];
|
5481
5532
|
return Promise.resolve(task(taskID)).then(function (tsk) {
|
5482
5533
|
var listener = listeners[taskID];
|
5483
|
-
if (listener) listener(tsk);
|
5534
|
+
if (listener) listener(tsk, appContext);
|
5484
5535
|
});
|
5485
5536
|
});
|
5486
5537
|
return Promise.resolve(_temp && _temp.then ? _temp.then(function () {}) : void 0);
|
@@ -5493,12 +5544,12 @@
|
|
5493
5544
|
};
|
5494
5545
|
}, [listeners]);
|
5495
5546
|
function addListener(taskID, listener) {
|
5496
|
-
var
|
5497
|
-
next[taskID] = listener;
|
5547
|
+
var _extends2;
|
5548
|
+
var next = _extends({}, listeners, (_extends2 = {}, _extends2[taskID] = listener, _extends2));
|
5498
5549
|
setListeners(next);
|
5499
5550
|
}
|
5500
5551
|
function addListeners(newListeners) {
|
5501
|
-
var next =
|
5552
|
+
var next = _extends({}, listeners, newListeners);
|
5502
5553
|
setListeners(next);
|
5503
5554
|
}
|
5504
5555
|
function removeListener(taskID) {
|
@@ -6062,7 +6113,7 @@
|
|
6062
6113
|
site.closeDialog();
|
6063
6114
|
}
|
6064
6115
|
var openDialog = function openDialog() {
|
6065
|
-
site.openDialog(
|
6116
|
+
site.openDialog(/*#__PURE__*/React__default["default"].createElement(ChangePasswordDialog, {
|
6066
6117
|
lang: lang,
|
6067
6118
|
label: label,
|
6068
6119
|
onOK: onOK,
|
@@ -6919,7 +6970,7 @@
|
|
6919
6970
|
}
|
6920
6971
|
});
|
6921
6972
|
}) : [];
|
6922
|
-
if (canDelete) item.actions.push(
|
6973
|
+
if (canDelete) item.actions.push(/*#__PURE__*/React__default["default"].createElement(Icon, {
|
6923
6974
|
icon: "delete",
|
6924
6975
|
size: "small",
|
6925
6976
|
clickable: true,
|
@@ -7529,7 +7580,7 @@
|
|
7529
7580
|
return Promise.reject(e);
|
7530
7581
|
}
|
7531
7582
|
};
|
7532
|
-
site.openDialog(
|
7583
|
+
site.openDialog(/*#__PURE__*/React__default["default"].createElement(CreateContentDialog, {
|
7533
7584
|
label: "" + name,
|
7534
7585
|
type: schema,
|
7535
7586
|
onOK: onOK,
|
@@ -8402,7 +8453,7 @@
|
|
8402
8453
|
return Promise.reject(e);
|
8403
8454
|
}
|
8404
8455
|
};
|
8405
|
-
site.openDialog(
|
8456
|
+
site.openDialog(/*#__PURE__*/React__default["default"].createElement(CreateContentDialog, {
|
8406
8457
|
label: "Crear " + name,
|
8407
8458
|
type: schema,
|
8408
8459
|
onOK: onOK,
|
@@ -8425,7 +8476,7 @@
|
|
8425
8476
|
return Promise.reject(e);
|
8426
8477
|
}
|
8427
8478
|
};
|
8428
|
-
site.openDialog(
|
8479
|
+
site.openDialog(/*#__PURE__*/React__default["default"].createElement(CreateContentDialog, {
|
8429
8480
|
label: "Nueva query",
|
8430
8481
|
type: QUERY,
|
8431
8482
|
onOK: onOK
|
@@ -8913,7 +8964,7 @@
|
|
8913
8964
|
}
|
8914
8965
|
});
|
8915
8966
|
}) : [];
|
8916
|
-
if (canDelete) item.actions.push(
|
8967
|
+
if (canDelete) item.actions.push(/*#__PURE__*/React__default["default"].createElement(Icon, {
|
8917
8968
|
icon: "delete",
|
8918
8969
|
size: "small",
|
8919
8970
|
clickable: true,
|
@@ -9327,7 +9378,7 @@
|
|
9327
9378
|
return Promise.reject(e);
|
9328
9379
|
}
|
9329
9380
|
};
|
9330
|
-
site.openDialog(
|
9381
|
+
site.openDialog(/*#__PURE__*/React__default["default"].createElement(CreateContentDialog, {
|
9331
9382
|
label: "Crear " + name,
|
9332
9383
|
type: schema,
|
9333
9384
|
onOK: onOK,
|
@@ -9349,7 +9400,7 @@
|
|
9349
9400
|
return Promise.reject(e);
|
9350
9401
|
}
|
9351
9402
|
};
|
9352
|
-
site.openDialog(
|
9403
|
+
site.openDialog(/*#__PURE__*/React__default["default"].createElement(CreateContentDialog, {
|
9353
9404
|
label: "Nueva query",
|
9354
9405
|
type: QUERY,
|
9355
9406
|
onOK: onOK
|
@@ -9865,7 +9916,7 @@
|
|
9865
9916
|
}
|
9866
9917
|
});
|
9867
9918
|
}) : [];
|
9868
|
-
if (canDelete) item.actions.push(
|
9919
|
+
if (canDelete) item.actions.push(/*#__PURE__*/React__default["default"].createElement(Icon, {
|
9869
9920
|
icon: "delete",
|
9870
9921
|
size: "small",
|
9871
9922
|
clickable: true,
|
@@ -10327,7 +10378,7 @@
|
|
10327
10378
|
return Promise.reject(e);
|
10328
10379
|
}
|
10329
10380
|
};
|
10330
|
-
site.openDialog(
|
10381
|
+
site.openDialog(/*#__PURE__*/React__default["default"].createElement(CreateContentDialog, {
|
10331
10382
|
label: "Crear " + name,
|
10332
10383
|
type: schema,
|
10333
10384
|
onOK: onOK,
|
@@ -10349,7 +10400,7 @@
|
|
10349
10400
|
return Promise.reject(e);
|
10350
10401
|
}
|
10351
10402
|
};
|
10352
|
-
site.openDialog(
|
10403
|
+
site.openDialog(/*#__PURE__*/React__default["default"].createElement(CreateContentDialog, {
|
10353
10404
|
label: "Nueva query",
|
10354
10405
|
type: QUERY,
|
10355
10406
|
onOK: onOK
|
@@ -10849,7 +10900,7 @@
|
|
10849
10900
|
}
|
10850
10901
|
});
|
10851
10902
|
}) : [];
|
10852
|
-
if (canDelete) item.actions.push(
|
10903
|
+
if (canDelete) item.actions.push(/*#__PURE__*/React__default["default"].createElement(Icon, {
|
10853
10904
|
icon: "delete",
|
10854
10905
|
size: "small",
|
10855
10906
|
clickable: true,
|