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.cjs
CHANGED
@@ -182,18 +182,13 @@ var Session = {
|
|
182
182
|
};
|
183
183
|
|
184
184
|
function _extends() {
|
185
|
-
_extends = Object.assign ? Object.assign.bind() : function (
|
186
|
-
for (var
|
187
|
-
var
|
188
|
-
for (var
|
189
|
-
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
190
|
-
target[key] = source[key];
|
191
|
-
}
|
192
|
-
}
|
185
|
+
return _extends = Object.assign ? Object.assign.bind() : function (n) {
|
186
|
+
for (var e = 1; e < arguments.length; e++) {
|
187
|
+
var t = arguments[e];
|
188
|
+
for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]);
|
193
189
|
}
|
194
|
-
return
|
195
|
-
};
|
196
|
-
return _extends.apply(this, arguments);
|
190
|
+
return n;
|
191
|
+
}, _extends.apply(null, arguments);
|
197
192
|
}
|
198
193
|
|
199
194
|
/**
|
@@ -3048,6 +3043,51 @@ var LoginBox = function LoginBox(_ref) {
|
|
3048
3043
|
}, /*#__PURE__*/React__default["default"].createElement(Text, null, message)) : null));
|
3049
3044
|
};
|
3050
3045
|
|
3046
|
+
function validatePassword(contraseña) {
|
3047
|
+
var error = "";
|
3048
|
+
|
3049
|
+
// Verificar longitud mínima y máxima
|
3050
|
+
if (contraseña.length < 15 || contraseña.length > 50) {
|
3051
|
+
error = 'La contraseña debe tener entre 15 y 50 caracteres.';
|
3052
|
+
return [false, error];
|
3053
|
+
}
|
3054
|
+
|
3055
|
+
// Verificar al menos una letra (mayúscula o minúscula)
|
3056
|
+
if (!/[A-Za-z]/.test(contraseña)) {
|
3057
|
+
error = 'La contraseña debe contener al menos una letra (A-Z o a-z).';
|
3058
|
+
return [false, error];
|
3059
|
+
}
|
3060
|
+
|
3061
|
+
// Verificar al menos un número
|
3062
|
+
if (!/[0-9]/.test(contraseña)) {
|
3063
|
+
error = 'La contraseña debe contener al menos un número (0-9).';
|
3064
|
+
return [false, error];
|
3065
|
+
}
|
3066
|
+
|
3067
|
+
// Verificar al menos una minúscula
|
3068
|
+
if (!/[a-z]/.test(contraseña)) {
|
3069
|
+
error = 'La contraseña debe contener al menos una letra en minúscula (a-z).';
|
3070
|
+
return [false, error];
|
3071
|
+
}
|
3072
|
+
|
3073
|
+
// Verificar al menos una mayúscula
|
3074
|
+
if (!/[A-Z]/.test(contraseña)) {
|
3075
|
+
error = 'La contraseña debe contener al menos una letra en mayúscula (A-Z).';
|
3076
|
+
return [false, error];
|
3077
|
+
}
|
3078
|
+
|
3079
|
+
// Verificar al menos un carácter especial
|
3080
|
+
if (!/[<>+&!?*\-_%\.:=]/.test(contraseña)) {
|
3081
|
+
error = 'La contraseña debe contener al menos un carácter especial (< > + & ! ? * - _ % . : =).';
|
3082
|
+
return [false, error];
|
3083
|
+
}
|
3084
|
+
|
3085
|
+
// Si todas las validaciones pasan
|
3086
|
+
return [true, error];
|
3087
|
+
}
|
3088
|
+
|
3089
|
+
//module.exports = { validatePassword }
|
3090
|
+
|
3051
3091
|
/**
|
3052
3092
|
* Reset Password
|
3053
3093
|
*/
|
@@ -3064,11 +3104,25 @@ var ResetPasswordBox = function ResetPasswordBox(_ref) {
|
|
3064
3104
|
var _useState = React.useState({}),
|
3065
3105
|
form = _useState[0],
|
3066
3106
|
setForm = _useState[1];
|
3067
|
-
var _useState2 = React.useState(),
|
3068
|
-
|
3069
|
-
|
3070
|
-
|
3071
|
-
|
3107
|
+
var _useState2 = React.useState(false),
|
3108
|
+
isValid = _useState2[0],
|
3109
|
+
setIsValid = _useState2[1];
|
3110
|
+
var _useState3 = React.useState(),
|
3111
|
+
error = _useState3[0],
|
3112
|
+
setError = _useState3[1];
|
3113
|
+
React.useEffect(function () {
|
3114
|
+
setIsValid(validate());
|
3115
|
+
}, [form.password1, form.password2]);
|
3116
|
+
function validate() {
|
3117
|
+
var hasRequiredUser = userRequired ? form.user && form.user.length > 0 : true;
|
3118
|
+
var hasPassword1 = form.password1 && form.password1.length > 0;
|
3119
|
+
var _ref2 = hasPassword1 ? validatePassword(form.password1) : [false, "La contraseña es requerida."],
|
3120
|
+
isValid = _ref2[0],
|
3121
|
+
error = _ref2[1];
|
3122
|
+
setError(error);
|
3123
|
+
var areEqual = form.password1 === form.password2;
|
3124
|
+
if (isValid && !areEqual) setError("Las contraseñas no coinciden.");
|
3125
|
+
return hasRequiredUser && areEqual && isValid;
|
3072
3126
|
}
|
3073
3127
|
function changeField(id, value) {
|
3074
3128
|
var _Object$assign;
|
@@ -3077,13 +3131,7 @@ var ResetPasswordBox = function ResetPasswordBox(_ref) {
|
|
3077
3131
|
}
|
3078
3132
|
function ok() {
|
3079
3133
|
if (onOK && canOK()) {
|
3080
|
-
|
3081
|
-
setError(null);
|
3082
|
-
onOK(form);
|
3083
|
-
} else {
|
3084
|
-
var errorLabel = lang === "EN" ? "Passwords do not match" : "Las claves no coinciden";
|
3085
|
-
setError(errorLabel);
|
3086
|
-
}
|
3134
|
+
onOK(form);
|
3087
3135
|
}
|
3088
3136
|
}
|
3089
3137
|
function close() {
|
@@ -3137,7 +3185,7 @@ var ResetPasswordBox = function ResetPasswordBox(_ref) {
|
|
3137
3185
|
}), /*#__PURE__*/React__default["default"].createElement(Button, {
|
3138
3186
|
label: okLabel,
|
3139
3187
|
raised: true,
|
3140
|
-
disabled: !
|
3188
|
+
disabled: !isValid,
|
3141
3189
|
action: ok
|
3142
3190
|
})));
|
3143
3191
|
};
|
@@ -5474,12 +5522,15 @@ var TaskContextProvider = function TaskContextProvider(props) {
|
|
5474
5522
|
url = _props$url === void 0 ? "/tasks" : _props$url,
|
5475
5523
|
_props$frequency = props.frequency,
|
5476
5524
|
frequency = _props$frequency === void 0 ? 1000 : _props$frequency,
|
5477
|
-
children = props.children
|
5525
|
+
children = props.children,
|
5526
|
+
ctx = props.ctx;
|
5478
5527
|
var API = CollectionAPI$1(url, host, "");
|
5479
5528
|
var _useState = React.useState({}),
|
5480
5529
|
listeners = _useState[0],
|
5481
5530
|
setListeners = _useState[1];
|
5531
|
+
var appContext = React.useContext(ctx);
|
5482
5532
|
React.useEffect(function () {
|
5533
|
+
if (Object.keys(listeners).length === 0) return;
|
5483
5534
|
var _interval = setInterval(function () {
|
5484
5535
|
try {
|
5485
5536
|
var taskIDs = Object.keys(listeners);
|
@@ -5487,7 +5538,7 @@ var TaskContextProvider = function TaskContextProvider(props) {
|
|
5487
5538
|
var taskID = taskIDs[i];
|
5488
5539
|
return Promise.resolve(task(taskID)).then(function (tsk) {
|
5489
5540
|
var listener = listeners[taskID];
|
5490
|
-
if (listener) listener(tsk);
|
5541
|
+
if (listener) listener(tsk, appContext);
|
5491
5542
|
});
|
5492
5543
|
});
|
5493
5544
|
return Promise.resolve(_temp && _temp.then ? _temp.then(function () {}) : void 0);
|
@@ -5500,12 +5551,12 @@ var TaskContextProvider = function TaskContextProvider(props) {
|
|
5500
5551
|
};
|
5501
5552
|
}, [listeners]);
|
5502
5553
|
function addListener(taskID, listener) {
|
5503
|
-
var
|
5504
|
-
next[taskID] = listener;
|
5554
|
+
var _extends2;
|
5555
|
+
var next = _extends({}, listeners, (_extends2 = {}, _extends2[taskID] = listener, _extends2));
|
5505
5556
|
setListeners(next);
|
5506
5557
|
}
|
5507
5558
|
function addListeners(newListeners) {
|
5508
|
-
var next =
|
5559
|
+
var next = _extends({}, listeners, newListeners);
|
5509
5560
|
setListeners(next);
|
5510
5561
|
}
|
5511
5562
|
function removeListener(taskID) {
|
@@ -6069,7 +6120,7 @@ var PasswordEditor = function PasswordEditor(props) {
|
|
6069
6120
|
site.closeDialog();
|
6070
6121
|
}
|
6071
6122
|
var openDialog = function openDialog() {
|
6072
|
-
site.openDialog(
|
6123
|
+
site.openDialog(/*#__PURE__*/React__default["default"].createElement(ChangePasswordDialog, {
|
6073
6124
|
lang: lang,
|
6074
6125
|
label: label,
|
6075
6126
|
onOK: onOK,
|
@@ -6926,7 +6977,7 @@ var TableEditor$3 = function TableEditor(props) {
|
|
6926
6977
|
}
|
6927
6978
|
});
|
6928
6979
|
}) : [];
|
6929
|
-
if (canDelete) item.actions.push(
|
6980
|
+
if (canDelete) item.actions.push(/*#__PURE__*/React__default["default"].createElement(Icon, {
|
6930
6981
|
icon: "delete",
|
6931
6982
|
size: "small",
|
6932
6983
|
clickable: true,
|
@@ -7536,7 +7587,7 @@ var CollectionPage$1 = function CollectionPage(props) {
|
|
7536
7587
|
return Promise.reject(e);
|
7537
7588
|
}
|
7538
7589
|
};
|
7539
|
-
site.openDialog(
|
7590
|
+
site.openDialog(/*#__PURE__*/React__default["default"].createElement(CreateContentDialog, {
|
7540
7591
|
label: "" + name,
|
7541
7592
|
type: schema,
|
7542
7593
|
onOK: onOK,
|
@@ -8409,7 +8460,7 @@ var TablePage = function TablePage(props) {
|
|
8409
8460
|
return Promise.reject(e);
|
8410
8461
|
}
|
8411
8462
|
};
|
8412
|
-
site.openDialog(
|
8463
|
+
site.openDialog(/*#__PURE__*/React__default["default"].createElement(CreateContentDialog, {
|
8413
8464
|
label: "Crear " + name,
|
8414
8465
|
type: schema,
|
8415
8466
|
onOK: onOK,
|
@@ -8432,7 +8483,7 @@ var TablePage = function TablePage(props) {
|
|
8432
8483
|
return Promise.reject(e);
|
8433
8484
|
}
|
8434
8485
|
};
|
8435
|
-
site.openDialog(
|
8486
|
+
site.openDialog(/*#__PURE__*/React__default["default"].createElement(CreateContentDialog, {
|
8436
8487
|
label: "Nueva query",
|
8437
8488
|
type: QUERY,
|
8438
8489
|
onOK: onOK
|
@@ -8920,7 +8971,7 @@ var TableEditor$2 = function TableEditor(props) {
|
|
8920
8971
|
}
|
8921
8972
|
});
|
8922
8973
|
}) : [];
|
8923
|
-
if (canDelete) item.actions.push(
|
8974
|
+
if (canDelete) item.actions.push(/*#__PURE__*/React__default["default"].createElement(Icon, {
|
8924
8975
|
icon: "delete",
|
8925
8976
|
size: "small",
|
8926
8977
|
clickable: true,
|
@@ -9334,7 +9385,7 @@ var TablePage2 = function TablePage2(props) {
|
|
9334
9385
|
return Promise.reject(e);
|
9335
9386
|
}
|
9336
9387
|
};
|
9337
|
-
site.openDialog(
|
9388
|
+
site.openDialog(/*#__PURE__*/React__default["default"].createElement(CreateContentDialog, {
|
9338
9389
|
label: "Crear " + name,
|
9339
9390
|
type: schema,
|
9340
9391
|
onOK: onOK,
|
@@ -9356,7 +9407,7 @@ var TablePage2 = function TablePage2(props) {
|
|
9356
9407
|
return Promise.reject(e);
|
9357
9408
|
}
|
9358
9409
|
};
|
9359
|
-
site.openDialog(
|
9410
|
+
site.openDialog(/*#__PURE__*/React__default["default"].createElement(CreateContentDialog, {
|
9360
9411
|
label: "Nueva query",
|
9361
9412
|
type: QUERY,
|
9362
9413
|
onOK: onOK
|
@@ -9872,7 +9923,7 @@ var TableEditor$1 = function TableEditor(props) {
|
|
9872
9923
|
}
|
9873
9924
|
});
|
9874
9925
|
}) : [];
|
9875
|
-
if (canDelete) item.actions.push(
|
9926
|
+
if (canDelete) item.actions.push(/*#__PURE__*/React__default["default"].createElement(Icon, {
|
9876
9927
|
icon: "delete",
|
9877
9928
|
size: "small",
|
9878
9929
|
clickable: true,
|
@@ -10334,7 +10385,7 @@ var TabbedTablePage = function TabbedTablePage(props) {
|
|
10334
10385
|
return Promise.reject(e);
|
10335
10386
|
}
|
10336
10387
|
};
|
10337
|
-
site.openDialog(
|
10388
|
+
site.openDialog(/*#__PURE__*/React__default["default"].createElement(CreateContentDialog, {
|
10338
10389
|
label: "Crear " + name,
|
10339
10390
|
type: schema,
|
10340
10391
|
onOK: onOK,
|
@@ -10356,7 +10407,7 @@ var TabbedTablePage = function TabbedTablePage(props) {
|
|
10356
10407
|
return Promise.reject(e);
|
10357
10408
|
}
|
10358
10409
|
};
|
10359
|
-
site.openDialog(
|
10410
|
+
site.openDialog(/*#__PURE__*/React__default["default"].createElement(CreateContentDialog, {
|
10360
10411
|
label: "Nueva query",
|
10361
10412
|
type: QUERY,
|
10362
10413
|
onOK: onOK
|
@@ -10856,7 +10907,7 @@ var TableEditor = function TableEditor(props) {
|
|
10856
10907
|
}
|
10857
10908
|
});
|
10858
10909
|
}) : [];
|
10859
|
-
if (canDelete) item.actions.push(
|
10910
|
+
if (canDelete) item.actions.push(/*#__PURE__*/React__default["default"].createElement(Icon, {
|
10860
10911
|
icon: "delete",
|
10861
10912
|
size: "small",
|
10862
10913
|
clickable: true,
|