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.modern.js
CHANGED
@@ -173,18 +173,13 @@ var Session = {
|
|
173
173
|
};
|
174
174
|
|
175
175
|
function _extends() {
|
176
|
-
_extends = Object.assign ? Object.assign.bind() : function (
|
177
|
-
for (var
|
178
|
-
var
|
179
|
-
for (var
|
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
|
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
|
-
|
3060
|
-
|
3061
|
-
|
3062
|
-
|
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
|
-
|
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: !
|
3179
|
+
disabled: !isValid,
|
3132
3180
|
action: ok
|
3133
3181
|
})));
|
3134
3182
|
};
|
@@ -5465,12 +5513,15 @@ var TaskContextProvider = function TaskContextProvider(props) {
|
|
5465
5513
|
url = _props$url === void 0 ? "/tasks" : _props$url,
|
5466
5514
|
_props$frequency = props.frequency,
|
5467
5515
|
frequency = _props$frequency === void 0 ? 1000 : _props$frequency,
|
5468
|
-
children = props.children
|
5516
|
+
children = props.children,
|
5517
|
+
ctx = props.ctx;
|
5469
5518
|
var API = CollectionAPI$1(url, host, "");
|
5470
5519
|
var _useState = useState({}),
|
5471
5520
|
listeners = _useState[0],
|
5472
5521
|
setListeners = _useState[1];
|
5522
|
+
var appContext = useContext(ctx);
|
5473
5523
|
useEffect(function () {
|
5524
|
+
if (Object.keys(listeners).length === 0) return;
|
5474
5525
|
var _interval = setInterval(function () {
|
5475
5526
|
try {
|
5476
5527
|
var taskIDs = Object.keys(listeners);
|
@@ -5478,7 +5529,7 @@ var TaskContextProvider = function TaskContextProvider(props) {
|
|
5478
5529
|
var taskID = taskIDs[i];
|
5479
5530
|
return Promise.resolve(task(taskID)).then(function (tsk) {
|
5480
5531
|
var listener = listeners[taskID];
|
5481
|
-
if (listener) listener(tsk);
|
5532
|
+
if (listener) listener(tsk, appContext);
|
5482
5533
|
});
|
5483
5534
|
});
|
5484
5535
|
return Promise.resolve(_temp && _temp.then ? _temp.then(function () {}) : void 0);
|
@@ -5491,12 +5542,12 @@ var TaskContextProvider = function TaskContextProvider(props) {
|
|
5491
5542
|
};
|
5492
5543
|
}, [listeners]);
|
5493
5544
|
function addListener(taskID, listener) {
|
5494
|
-
var
|
5495
|
-
next[taskID] = listener;
|
5545
|
+
var _extends2;
|
5546
|
+
var next = _extends({}, listeners, (_extends2 = {}, _extends2[taskID] = listener, _extends2));
|
5496
5547
|
setListeners(next);
|
5497
5548
|
}
|
5498
5549
|
function addListeners(newListeners) {
|
5499
|
-
var next =
|
5550
|
+
var next = _extends({}, listeners, newListeners);
|
5500
5551
|
setListeners(next);
|
5501
5552
|
}
|
5502
5553
|
function removeListener(taskID) {
|
@@ -6060,7 +6111,7 @@ var PasswordEditor = function PasswordEditor(props) {
|
|
6060
6111
|
site.closeDialog();
|
6061
6112
|
}
|
6062
6113
|
var openDialog = function openDialog() {
|
6063
|
-
site.openDialog(
|
6114
|
+
site.openDialog(/*#__PURE__*/React.createElement(ChangePasswordDialog, {
|
6064
6115
|
lang: lang,
|
6065
6116
|
label: label,
|
6066
6117
|
onOK: onOK,
|
@@ -6917,7 +6968,7 @@ var TableEditor$3 = function TableEditor(props) {
|
|
6917
6968
|
}
|
6918
6969
|
});
|
6919
6970
|
}) : [];
|
6920
|
-
if (canDelete) item.actions.push(
|
6971
|
+
if (canDelete) item.actions.push(/*#__PURE__*/React.createElement(Icon, {
|
6921
6972
|
icon: "delete",
|
6922
6973
|
size: "small",
|
6923
6974
|
clickable: true,
|
@@ -7527,7 +7578,7 @@ var CollectionPage$1 = function CollectionPage(props) {
|
|
7527
7578
|
return Promise.reject(e);
|
7528
7579
|
}
|
7529
7580
|
};
|
7530
|
-
site.openDialog(
|
7581
|
+
site.openDialog(/*#__PURE__*/React.createElement(CreateContentDialog, {
|
7531
7582
|
label: "" + name,
|
7532
7583
|
type: schema,
|
7533
7584
|
onOK: onOK,
|
@@ -8400,7 +8451,7 @@ var TablePage = function TablePage(props) {
|
|
8400
8451
|
return Promise.reject(e);
|
8401
8452
|
}
|
8402
8453
|
};
|
8403
|
-
site.openDialog(
|
8454
|
+
site.openDialog(/*#__PURE__*/React.createElement(CreateContentDialog, {
|
8404
8455
|
label: "Crear " + name,
|
8405
8456
|
type: schema,
|
8406
8457
|
onOK: onOK,
|
@@ -8423,7 +8474,7 @@ var TablePage = function TablePage(props) {
|
|
8423
8474
|
return Promise.reject(e);
|
8424
8475
|
}
|
8425
8476
|
};
|
8426
|
-
site.openDialog(
|
8477
|
+
site.openDialog(/*#__PURE__*/React.createElement(CreateContentDialog, {
|
8427
8478
|
label: "Nueva query",
|
8428
8479
|
type: QUERY,
|
8429
8480
|
onOK: onOK
|
@@ -8911,7 +8962,7 @@ var TableEditor$2 = function TableEditor(props) {
|
|
8911
8962
|
}
|
8912
8963
|
});
|
8913
8964
|
}) : [];
|
8914
|
-
if (canDelete) item.actions.push(
|
8965
|
+
if (canDelete) item.actions.push(/*#__PURE__*/React.createElement(Icon, {
|
8915
8966
|
icon: "delete",
|
8916
8967
|
size: "small",
|
8917
8968
|
clickable: true,
|
@@ -9325,7 +9376,7 @@ var TablePage2 = function TablePage2(props) {
|
|
9325
9376
|
return Promise.reject(e);
|
9326
9377
|
}
|
9327
9378
|
};
|
9328
|
-
site.openDialog(
|
9379
|
+
site.openDialog(/*#__PURE__*/React.createElement(CreateContentDialog, {
|
9329
9380
|
label: "Crear " + name,
|
9330
9381
|
type: schema,
|
9331
9382
|
onOK: onOK,
|
@@ -9347,7 +9398,7 @@ var TablePage2 = function TablePage2(props) {
|
|
9347
9398
|
return Promise.reject(e);
|
9348
9399
|
}
|
9349
9400
|
};
|
9350
|
-
site.openDialog(
|
9401
|
+
site.openDialog(/*#__PURE__*/React.createElement(CreateContentDialog, {
|
9351
9402
|
label: "Nueva query",
|
9352
9403
|
type: QUERY,
|
9353
9404
|
onOK: onOK
|
@@ -9863,7 +9914,7 @@ var TableEditor$1 = function TableEditor(props) {
|
|
9863
9914
|
}
|
9864
9915
|
});
|
9865
9916
|
}) : [];
|
9866
|
-
if (canDelete) item.actions.push(
|
9917
|
+
if (canDelete) item.actions.push(/*#__PURE__*/React.createElement(Icon, {
|
9867
9918
|
icon: "delete",
|
9868
9919
|
size: "small",
|
9869
9920
|
clickable: true,
|
@@ -10325,7 +10376,7 @@ var TabbedTablePage = function TabbedTablePage(props) {
|
|
10325
10376
|
return Promise.reject(e);
|
10326
10377
|
}
|
10327
10378
|
};
|
10328
|
-
site.openDialog(
|
10379
|
+
site.openDialog(/*#__PURE__*/React.createElement(CreateContentDialog, {
|
10329
10380
|
label: "Crear " + name,
|
10330
10381
|
type: schema,
|
10331
10382
|
onOK: onOK,
|
@@ -10347,7 +10398,7 @@ var TabbedTablePage = function TabbedTablePage(props) {
|
|
10347
10398
|
return Promise.reject(e);
|
10348
10399
|
}
|
10349
10400
|
};
|
10350
|
-
site.openDialog(
|
10401
|
+
site.openDialog(/*#__PURE__*/React.createElement(CreateContentDialog, {
|
10351
10402
|
label: "Nueva query",
|
10352
10403
|
type: QUERY,
|
10353
10404
|
onOK: onOK
|
@@ -10847,7 +10898,7 @@ var TableEditor = function TableEditor(props) {
|
|
10847
10898
|
}
|
10848
10899
|
});
|
10849
10900
|
}) : [];
|
10850
|
-
if (canDelete) item.actions.push(
|
10901
|
+
if (canDelete) item.actions.push(/*#__PURE__*/React.createElement(Icon, {
|
10851
10902
|
icon: "delete",
|
10852
10903
|
size: "small",
|
10853
10904
|
clickable: true,
|