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.
- package/dist/index.cjs +88 -39
- package/dist/index.cjs.map +1 -1
- package/dist/index.modern.js +88 -39
- package/dist/index.modern.js.map +1 -1
- package/dist/index.umd.js +88 -39
- package/dist/index.umd.js.map +1 -1
- package/package.json +5 -3
- package/src/incubator/task.js +5 -4
- 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
|
};
|
@@ -5480,6 +5528,7 @@ var TaskContextProvider = function TaskContextProvider(props) {
|
|
5480
5528
|
listeners = _useState[0],
|
5481
5529
|
setListeners = _useState[1];
|
5482
5530
|
React.useEffect(function () {
|
5531
|
+
if (Object.keys(listeners).length === 0) return;
|
5483
5532
|
var _interval = setInterval(function () {
|
5484
5533
|
try {
|
5485
5534
|
var taskIDs = Object.keys(listeners);
|
@@ -5500,12 +5549,12 @@ var TaskContextProvider = function TaskContextProvider(props) {
|
|
5500
5549
|
};
|
5501
5550
|
}, [listeners]);
|
5502
5551
|
function addListener(taskID, listener) {
|
5503
|
-
var
|
5504
|
-
next[taskID] = listener;
|
5552
|
+
var _extends2;
|
5553
|
+
var next = _extends({}, listeners, (_extends2 = {}, _extends2[taskID] = listener, _extends2));
|
5505
5554
|
setListeners(next);
|
5506
5555
|
}
|
5507
5556
|
function addListeners(newListeners) {
|
5508
|
-
var next =
|
5557
|
+
var next = _extends({}, listeners, newListeners);
|
5509
5558
|
setListeners(next);
|
5510
5559
|
}
|
5511
5560
|
function removeListener(taskID) {
|
@@ -6069,7 +6118,7 @@ var PasswordEditor = function PasswordEditor(props) {
|
|
6069
6118
|
site.closeDialog();
|
6070
6119
|
}
|
6071
6120
|
var openDialog = function openDialog() {
|
6072
|
-
site.openDialog(
|
6121
|
+
site.openDialog(/*#__PURE__*/React__default["default"].createElement(ChangePasswordDialog, {
|
6073
6122
|
lang: lang,
|
6074
6123
|
label: label,
|
6075
6124
|
onOK: onOK,
|
@@ -6926,7 +6975,7 @@ var TableEditor$3 = function TableEditor(props) {
|
|
6926
6975
|
}
|
6927
6976
|
});
|
6928
6977
|
}) : [];
|
6929
|
-
if (canDelete) item.actions.push(
|
6978
|
+
if (canDelete) item.actions.push(/*#__PURE__*/React__default["default"].createElement(Icon, {
|
6930
6979
|
icon: "delete",
|
6931
6980
|
size: "small",
|
6932
6981
|
clickable: true,
|
@@ -7536,7 +7585,7 @@ var CollectionPage$1 = function CollectionPage(props) {
|
|
7536
7585
|
return Promise.reject(e);
|
7537
7586
|
}
|
7538
7587
|
};
|
7539
|
-
site.openDialog(
|
7588
|
+
site.openDialog(/*#__PURE__*/React__default["default"].createElement(CreateContentDialog, {
|
7540
7589
|
label: "" + name,
|
7541
7590
|
type: schema,
|
7542
7591
|
onOK: onOK,
|
@@ -8409,7 +8458,7 @@ var TablePage = function TablePage(props) {
|
|
8409
8458
|
return Promise.reject(e);
|
8410
8459
|
}
|
8411
8460
|
};
|
8412
|
-
site.openDialog(
|
8461
|
+
site.openDialog(/*#__PURE__*/React__default["default"].createElement(CreateContentDialog, {
|
8413
8462
|
label: "Crear " + name,
|
8414
8463
|
type: schema,
|
8415
8464
|
onOK: onOK,
|
@@ -8432,7 +8481,7 @@ var TablePage = function TablePage(props) {
|
|
8432
8481
|
return Promise.reject(e);
|
8433
8482
|
}
|
8434
8483
|
};
|
8435
|
-
site.openDialog(
|
8484
|
+
site.openDialog(/*#__PURE__*/React__default["default"].createElement(CreateContentDialog, {
|
8436
8485
|
label: "Nueva query",
|
8437
8486
|
type: QUERY,
|
8438
8487
|
onOK: onOK
|
@@ -8920,7 +8969,7 @@ var TableEditor$2 = function TableEditor(props) {
|
|
8920
8969
|
}
|
8921
8970
|
});
|
8922
8971
|
}) : [];
|
8923
|
-
if (canDelete) item.actions.push(
|
8972
|
+
if (canDelete) item.actions.push(/*#__PURE__*/React__default["default"].createElement(Icon, {
|
8924
8973
|
icon: "delete",
|
8925
8974
|
size: "small",
|
8926
8975
|
clickable: true,
|
@@ -9334,7 +9383,7 @@ var TablePage2 = function TablePage2(props) {
|
|
9334
9383
|
return Promise.reject(e);
|
9335
9384
|
}
|
9336
9385
|
};
|
9337
|
-
site.openDialog(
|
9386
|
+
site.openDialog(/*#__PURE__*/React__default["default"].createElement(CreateContentDialog, {
|
9338
9387
|
label: "Crear " + name,
|
9339
9388
|
type: schema,
|
9340
9389
|
onOK: onOK,
|
@@ -9356,7 +9405,7 @@ var TablePage2 = function TablePage2(props) {
|
|
9356
9405
|
return Promise.reject(e);
|
9357
9406
|
}
|
9358
9407
|
};
|
9359
|
-
site.openDialog(
|
9408
|
+
site.openDialog(/*#__PURE__*/React__default["default"].createElement(CreateContentDialog, {
|
9360
9409
|
label: "Nueva query",
|
9361
9410
|
type: QUERY,
|
9362
9411
|
onOK: onOK
|
@@ -9872,7 +9921,7 @@ var TableEditor$1 = function TableEditor(props) {
|
|
9872
9921
|
}
|
9873
9922
|
});
|
9874
9923
|
}) : [];
|
9875
|
-
if (canDelete) item.actions.push(
|
9924
|
+
if (canDelete) item.actions.push(/*#__PURE__*/React__default["default"].createElement(Icon, {
|
9876
9925
|
icon: "delete",
|
9877
9926
|
size: "small",
|
9878
9927
|
clickable: true,
|
@@ -10334,7 +10383,7 @@ var TabbedTablePage = function TabbedTablePage(props) {
|
|
10334
10383
|
return Promise.reject(e);
|
10335
10384
|
}
|
10336
10385
|
};
|
10337
|
-
site.openDialog(
|
10386
|
+
site.openDialog(/*#__PURE__*/React__default["default"].createElement(CreateContentDialog, {
|
10338
10387
|
label: "Crear " + name,
|
10339
10388
|
type: schema,
|
10340
10389
|
onOK: onOK,
|
@@ -10356,7 +10405,7 @@ var TabbedTablePage = function TabbedTablePage(props) {
|
|
10356
10405
|
return Promise.reject(e);
|
10357
10406
|
}
|
10358
10407
|
};
|
10359
|
-
site.openDialog(
|
10408
|
+
site.openDialog(/*#__PURE__*/React__default["default"].createElement(CreateContentDialog, {
|
10360
10409
|
label: "Nueva query",
|
10361
10410
|
type: QUERY,
|
10362
10411
|
onOK: onOK
|
@@ -10856,7 +10905,7 @@ var TableEditor = function TableEditor(props) {
|
|
10856
10905
|
}
|
10857
10906
|
});
|
10858
10907
|
}) : [];
|
10859
|
-
if (canDelete) item.actions.push(
|
10908
|
+
if (canDelete) item.actions.push(/*#__PURE__*/React__default["default"].createElement(Icon, {
|
10860
10909
|
icon: "delete",
|
10861
10910
|
size: "small",
|
10862
10911
|
clickable: true,
|