contentoh-components-library 21.0.36 → 21.0.39
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/components/atoms/GeneralInput/index.js +8 -2
- package/dist/components/atoms/Loading/styles.js +1 -1
- package/dist/components/molecules/EmailResetPasswordLogin/index.js +1 -3
- package/dist/components/molecules/LoginPasswordStrength/index.js +9 -3
- package/dist/components/molecules/RegistrationFirstStep/index.js +49 -15
- package/dist/components/molecules/RegistrationSecondStep/index.js +130 -47
- package/dist/components/molecules/SignInLogin/index.js +1 -1
- package/dist/components/molecules/TagAndInput/index.js +8 -2
- package/package.json +2 -2
- package/src/components/atoms/GeneralInput/index.js +6 -0
- package/src/components/atoms/Loading/styles.js +2 -2
- package/src/components/molecules/EmailResetPasswordLogin/index.js +2 -2
- package/src/components/molecules/LoginPasswordStrength/index.js +11 -1
- package/src/components/molecules/RegistrationFirstStep/index.js +57 -23
- package/src/components/molecules/RegistrationSecondStep/index.js +76 -3
- package/src/components/molecules/SignInLogin/index.js +2 -2
- package/src/components/molecules/TagAndInput/index.js +6 -0
|
@@ -27,7 +27,10 @@ var GeneralInput = function GeneralInput(_ref) {
|
|
|
27
27
|
position = _ref.position,
|
|
28
28
|
inputsArray = _ref.inputsArray,
|
|
29
29
|
maxLength = _ref.maxLength,
|
|
30
|
-
inputSize = _ref.inputSize
|
|
30
|
+
inputSize = _ref.inputSize,
|
|
31
|
+
onChange = _ref.onChange,
|
|
32
|
+
required = _ref.required,
|
|
33
|
+
defaultValue = _ref.defaultValue;
|
|
31
34
|
|
|
32
35
|
var _useState = (0, _react.useState)({
|
|
33
36
|
value: inputValue !== null && inputValue !== void 0 ? inputValue : ""
|
|
@@ -63,7 +66,10 @@ var GeneralInput = function GeneralInput(_ref) {
|
|
|
63
66
|
onInput: function onInput(e) {
|
|
64
67
|
return onHandleChange(e);
|
|
65
68
|
},
|
|
66
|
-
maxLength: maxLength && maxLength
|
|
69
|
+
maxLength: maxLength && maxLength,
|
|
70
|
+
onChange: onChange,
|
|
71
|
+
required: required,
|
|
72
|
+
defaultValue: defaultValue
|
|
67
73
|
}) : /*#__PURE__*/(0, _jsxRuntime.jsx)("textarea", {
|
|
68
74
|
name: inputName,
|
|
69
75
|
id: inputId,
|
|
@@ -13,6 +13,6 @@ var _styledComponents = _interopRequireDefault(require("styled-components"));
|
|
|
13
13
|
|
|
14
14
|
var _templateObject;
|
|
15
15
|
|
|
16
|
-
var Container = _styledComponents.default.div(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n display: flex;\n justify-content: center;\n align-items: center;\n height: 100%;\n width:
|
|
16
|
+
var Container = _styledComponents.default.div(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n display: flex;\n justify-content: center;\n align-items: center;\n height: 100%;\n width: 50%;\n .loader {\n display: flex;\n justify-content: center;\n align-items: center;\n height: 100%;\n width: 50%;\n span {\n display: inline-block;\n border-radius: 100%;\n margin-left: 5px;\n opacity: 1;\n }\n .first {\n background-color: #ff75cf;\n }\n .second {\n background-color: #e33aa9;\n }\n .third {\n background-color: #b12d84;\n }\n span:nth-child(1) {\n width: 16px;\n height: 16px;\n animation: opacitychange 1s ease-in-out infinite;\n }\n span:nth-child(2) {\n width: 18px;\n height: 18px;\n\n animation: opacitychange 1s ease-in-out 0.33s infinite;\n }\n span:nth-child(3) {\n width: 20px;\n height: 20px;\n\n animation: opacitychange 1s ease-in-out 0.66s infinite;\n }\n @keyframes opacitychange {\n 0%,\n 100% {\n opacity: 0;\n }\n 60% {\n opacity: 1;\n }\n }\n }\n"])));
|
|
17
17
|
|
|
18
18
|
exports.Container = Container;
|
|
@@ -29,8 +29,6 @@ var _TagAndInput = require("../../molecules/TagAndInput");
|
|
|
29
29
|
|
|
30
30
|
var _GeneralButton = require("../../atoms/GeneralButton");
|
|
31
31
|
|
|
32
|
-
var _awsAmplify = require("aws-amplify");
|
|
33
|
-
|
|
34
32
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
35
33
|
|
|
36
34
|
var EmailResetPasswordLogin = function EmailResetPasswordLogin(props) {
|
|
@@ -77,7 +75,7 @@ var EmailResetPasswordLogin = function EmailResetPasswordLogin(props) {
|
|
|
77
75
|
|
|
78
76
|
_context.prev = 9;
|
|
79
77
|
_context.next = 12;
|
|
80
|
-
return
|
|
78
|
+
return props.Auth.forgotPassword(email);
|
|
81
79
|
|
|
82
80
|
case 12:
|
|
83
81
|
sessionStorage.setItem("email", JSON.stringify(email));
|
|
@@ -20,7 +20,9 @@ var _jsxRuntime = require("react/jsx-runtime");
|
|
|
20
20
|
var LoginPasswordStrength = function LoginPasswordStrength(_ref) {
|
|
21
21
|
var emptyPassword = _ref.emptyPassword,
|
|
22
22
|
emptyConfirmPassword = _ref.emptyConfirmPassword,
|
|
23
|
-
matchPasswords = _ref.matchPasswords
|
|
23
|
+
matchPasswords = _ref.matchPasswords,
|
|
24
|
+
onChange = _ref.onChange,
|
|
25
|
+
required = _ref.required;
|
|
24
26
|
|
|
25
27
|
var _useState = (0, _react.useState)(0),
|
|
26
28
|
_useState2 = (0, _slicedToArray2.default)(_useState, 2),
|
|
@@ -74,7 +76,9 @@ var LoginPasswordStrength = function LoginPasswordStrength(_ref) {
|
|
|
74
76
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_TagAndInput.TagAndInput, {
|
|
75
77
|
inputType: "password",
|
|
76
78
|
inputId: "newPasswordInput",
|
|
77
|
-
label: "Ingrese su nueva contraseña"
|
|
79
|
+
label: "Ingrese su nueva contraseña",
|
|
80
|
+
required: required,
|
|
81
|
+
onChange: onChange
|
|
78
82
|
}), emptyPassword && /*#__PURE__*/(0, _jsxRuntime.jsx)("label", {
|
|
79
83
|
children: "La contrase\xF1a debe ser minimo de 8 caracteres"
|
|
80
84
|
})]
|
|
@@ -118,7 +122,9 @@ var LoginPasswordStrength = function LoginPasswordStrength(_ref) {
|
|
|
118
122
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_TagAndInput.TagAndInput, {
|
|
119
123
|
inputType: "password",
|
|
120
124
|
inputId: "confirmPasswordInput",
|
|
121
|
-
label: "Confirme la nueva contraseña"
|
|
125
|
+
label: "Confirme la nueva contraseña",
|
|
126
|
+
required: required,
|
|
127
|
+
onChange: onChange
|
|
122
128
|
}), emptyConfirmPassword && !emptyPassword && /*#__PURE__*/(0, _jsxRuntime.jsx)("label", {
|
|
123
129
|
children: "Confirme la contrase\xF1a"
|
|
124
130
|
}), !emptyConfirmPassword && !emptyPassword && !matchPasswords && /*#__PURE__*/(0, _jsxRuntime.jsx)("label", {
|
|
@@ -95,7 +95,6 @@ var RegistrationFirstStep = function RegistrationFirstStep(props) {
|
|
|
95
95
|
|
|
96
96
|
sessionStorage.getItem("resetPasswordProcess") && sessionStorage.getItem("resetPasswordProcess");
|
|
97
97
|
}, []);
|
|
98
|
-
var paisesEsp = ["Argentina", "Colombia", "Costa Rica", "Ecuador", "El Salvador", "Honduras", "México", "Panamá", "Perú"];
|
|
99
98
|
|
|
100
99
|
var updateInfo = function updateInfo(e, newValue) {
|
|
101
100
|
var nuevoUsuario = JSON.parse(sessionStorage.getItem("nuevoRegistro"));
|
|
@@ -189,7 +188,7 @@ var RegistrationFirstStep = function RegistrationFirstStep(props) {
|
|
|
189
188
|
label: "Nombre",
|
|
190
189
|
inputPlaceHolder: "Nombre",
|
|
191
190
|
defaultValue: JSON.parse(sessionStorage.getItem("nuevoRegistro")).name,
|
|
192
|
-
required:
|
|
191
|
+
required: "required",
|
|
193
192
|
onInput: function onInput(e) {
|
|
194
193
|
return updateInfo(e, e.target.value);
|
|
195
194
|
}
|
|
@@ -197,27 +196,45 @@ var RegistrationFirstStep = function RegistrationFirstStep(props) {
|
|
|
197
196
|
inputType: "text",
|
|
198
197
|
inputId: "lastNameInput",
|
|
199
198
|
label: "Apellido",
|
|
200
|
-
inputPlaceHolder: "Apellido"
|
|
199
|
+
inputPlaceHolder: "Apellido",
|
|
200
|
+
defaultValue: JSON.parse(sessionStorage.getItem("nuevoRegistro")).lastName,
|
|
201
|
+
required: "required",
|
|
202
|
+
onChange: function onChange(e) {
|
|
203
|
+
return updateInfo(e, e.target.value);
|
|
204
|
+
}
|
|
201
205
|
})]
|
|
202
|
-
}), emptyName && /*#__PURE__*/(0, _jsxRuntime.jsx)("label", {
|
|
206
|
+
}), emptyName && showErrors && /*#__PURE__*/(0, _jsxRuntime.jsx)("label", {
|
|
203
207
|
children: "Ingrese su nombre"
|
|
204
|
-
}), emptyLastName && /*#__PURE__*/(0, _jsxRuntime.jsx)("label", {
|
|
208
|
+
}), emptyLastName && showErrors && /*#__PURE__*/(0, _jsxRuntime.jsx)("label", {
|
|
205
209
|
children: "Ingrese sus apellidos"
|
|
206
210
|
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_TagAndInput.TagAndInput, {
|
|
207
211
|
inputType: "text",
|
|
208
212
|
inputId: "emailInput",
|
|
209
213
|
label: "Correo electrónico",
|
|
210
|
-
inputPlaceHolder: "username@contentoh.com"
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
+
inputPlaceHolder: "username@contentoh.com",
|
|
215
|
+
required: "required",
|
|
216
|
+
defaultValue: JSON.parse(sessionStorage.getItem("nuevoRegistro")).email,
|
|
217
|
+
id: "emailInput",
|
|
218
|
+
onChange: function onChange(e) {
|
|
219
|
+
return updateInfo(e, e.target.value);
|
|
220
|
+
}
|
|
221
|
+
}), regError && JSON.parse(sessionStorage.getItem("registrationError")) === "emailExists" && /*#__PURE__*/(0, _jsxRuntime.jsx)("label", {
|
|
222
|
+
children: "Ya existe una cuenta asociada a este correo"
|
|
223
|
+
}), emptyEmail && showErrors && /*#__PURE__*/(0, _jsxRuntime.jsx)("label", {
|
|
224
|
+
children: "Ingrese su email"
|
|
225
|
+
}), emailFormatError && showErrors && !emptyEmail && /*#__PURE__*/(0, _jsxRuntime.jsx)("label", {
|
|
214
226
|
children: "Ingrese un correo v\xE1lido"
|
|
215
227
|
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_TagAndInput.TagAndInput, {
|
|
216
228
|
inputType: "text",
|
|
217
229
|
inputId: "jobInput",
|
|
218
230
|
label: "Puesto laboral",
|
|
219
|
-
inputPlaceHolder: "Puesto dentro de la empresa"
|
|
220
|
-
|
|
231
|
+
inputPlaceHolder: "Puesto dentro de la empresa",
|
|
232
|
+
defaultValue: JSON.parse(sessionStorage.getItem("nuevoRegistro")).position,
|
|
233
|
+
required: "required",
|
|
234
|
+
onChange: function onChange(e) {
|
|
235
|
+
return updateInfo(e, e.target.value);
|
|
236
|
+
}
|
|
237
|
+
}), emptyJob && showErrors && /*#__PURE__*/(0, _jsxRuntime.jsx)("label", {
|
|
221
238
|
children: "Ingrese su puesto"
|
|
222
239
|
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_ScreenHeader.ScreenHeader, {
|
|
223
240
|
text: "Teléfono",
|
|
@@ -250,10 +267,20 @@ var RegistrationFirstStep = function RegistrationFirstStep(props) {
|
|
|
250
267
|
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_GeneralInput.GeneralInput, {
|
|
251
268
|
inputId: "phoneInput",
|
|
252
269
|
inputType: "text",
|
|
253
|
-
inputPlaceholder: "Teléfono"
|
|
270
|
+
inputPlaceholder: "Teléfono",
|
|
271
|
+
defaultValue: //phone without countryCode
|
|
272
|
+
JSON.parse(sessionStorage.getItem("nuevoRegistro")).phone.substring(JSON.parse(sessionStorage.getItem("countryCode")).length, JSON.parse(sessionStorage.getItem("nuevoRegistro")).phone.length - 1),
|
|
273
|
+
required: "required",
|
|
274
|
+
onChange: function onChange(e) {
|
|
275
|
+
return updateInfo(e, e.target.value);
|
|
276
|
+
}
|
|
254
277
|
})]
|
|
255
|
-
}),
|
|
278
|
+
}), regError && JSON.parse(sessionStorage.getItem("registrationError")) === "phoneFormatError" && /*#__PURE__*/(0, _jsxRuntime.jsx)("label", {
|
|
279
|
+
children: "Introduzca un n\xFAmero v\xE1lido"
|
|
280
|
+
}), emptyPhone && showErrors && /*#__PURE__*/(0, _jsxRuntime.jsx)("label", {
|
|
256
281
|
children: "Ingrese su n\xFAmero de tel\xE9fono"
|
|
282
|
+
}), phoneFormatError && showErrors && /*#__PURE__*/(0, _jsxRuntime.jsx)("label", {
|
|
283
|
+
children: "Introduzca un n\xFAmero valido ( Solo numeros )"
|
|
257
284
|
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_ScreenHeader.ScreenHeader, {
|
|
258
285
|
text: "País",
|
|
259
286
|
headerType: "input-name-header"
|
|
@@ -261,6 +288,10 @@ var RegistrationFirstStep = function RegistrationFirstStep(props) {
|
|
|
261
288
|
name: "select",
|
|
262
289
|
className: "country-options",
|
|
263
290
|
id: "countrySelect",
|
|
291
|
+
defaultValue: JSON.parse(sessionStorage.getItem("nuevoRegistro")).country,
|
|
292
|
+
onChange: function onChange(e) {
|
|
293
|
+
return updateInfo(e, e.target.value);
|
|
294
|
+
},
|
|
264
295
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("option", {
|
|
265
296
|
value: "value1",
|
|
266
297
|
selected: true,
|
|
@@ -290,7 +321,7 @@ var RegistrationFirstStep = function RegistrationFirstStep(props) {
|
|
|
290
321
|
value: "value3",
|
|
291
322
|
children: "Per\xFA"
|
|
292
323
|
})]
|
|
293
|
-
}), emptyEmail && /*#__PURE__*/(0, _jsxRuntime.jsx)("label", {
|
|
324
|
+
}), emptyEmail && showErrors && /*#__PURE__*/(0, _jsxRuntime.jsx)("label", {
|
|
294
325
|
children: "Seleccione su pa\xEDs"
|
|
295
326
|
})]
|
|
296
327
|
}, "3"), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
@@ -299,7 +330,7 @@ var RegistrationFirstStep = function RegistrationFirstStep(props) {
|
|
|
299
330
|
buttonType: "general-default-button",
|
|
300
331
|
label: "Enviar",
|
|
301
332
|
onClick: function onClick(e) {
|
|
302
|
-
return
|
|
333
|
+
return validateForm(e);
|
|
303
334
|
}
|
|
304
335
|
})
|
|
305
336
|
}, "4"), /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
@@ -317,6 +348,9 @@ var RegistrationFirstStep = function RegistrationFirstStep(props) {
|
|
|
317
348
|
className: "new-login",
|
|
318
349
|
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)("p", {
|
|
319
350
|
className: "pre-registro",
|
|
351
|
+
onClick: function onClick() {
|
|
352
|
+
return props.setPaso(7);
|
|
353
|
+
},
|
|
320
354
|
children: ["\xBFYa tienes una cuenta?", /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
|
|
321
355
|
children: " Inicia Sesi\xF3n"
|
|
322
356
|
})]
|
|
@@ -7,10 +7,6 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
7
7
|
});
|
|
8
8
|
exports.RegistrationSecondStep = void 0;
|
|
9
9
|
|
|
10
|
-
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
|
11
|
-
|
|
12
|
-
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/asyncToGenerator"));
|
|
13
|
-
|
|
14
10
|
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/slicedToArray"));
|
|
15
11
|
|
|
16
12
|
var _styles = require("./styles");
|
|
@@ -31,53 +27,136 @@ var _LogoImage = require("../../atoms/LogoImage");
|
|
|
31
27
|
|
|
32
28
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
33
29
|
|
|
34
|
-
var RegistrationSecondStep = function RegistrationSecondStep() {
|
|
35
|
-
var _useState = (0, _react.useState)(
|
|
30
|
+
var RegistrationSecondStep = function RegistrationSecondStep(props) {
|
|
31
|
+
var _useState = (0, _react.useState)(0),
|
|
36
32
|
_useState2 = (0, _slicedToArray2.default)(_useState, 2),
|
|
37
|
-
|
|
38
|
-
|
|
33
|
+
passwordStrength = _useState2[0],
|
|
34
|
+
setPasswordStrenght = _useState2[1];
|
|
39
35
|
|
|
40
|
-
var _useState3 = (0, _react.useState)(
|
|
36
|
+
var _useState3 = (0, _react.useState)(""),
|
|
41
37
|
_useState4 = (0, _slicedToArray2.default)(_useState3, 2),
|
|
42
|
-
|
|
43
|
-
|
|
38
|
+
passwordFinal = _useState4[0],
|
|
39
|
+
setPasswordFinal = _useState4[1];
|
|
44
40
|
|
|
45
|
-
var _useState5 = (0, _react.useState)(
|
|
41
|
+
var _useState5 = (0, _react.useState)(""),
|
|
46
42
|
_useState6 = (0, _slicedToArray2.default)(_useState5, 2),
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
var
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
43
|
+
repeatedPassword = _useState6[0],
|
|
44
|
+
setRepeatedPassword = _useState6[1];
|
|
45
|
+
|
|
46
|
+
var _useState7 = (0, _react.useState)(false),
|
|
47
|
+
_useState8 = (0, _slicedToArray2.default)(_useState7, 2),
|
|
48
|
+
passwordMatches = _useState8[0],
|
|
49
|
+
setPasswordMatches = _useState8[1];
|
|
50
|
+
|
|
51
|
+
var _useState9 = (0, _react.useState)(true),
|
|
52
|
+
_useState10 = (0, _slicedToArray2.default)(_useState9, 2),
|
|
53
|
+
passwordToShort = _useState10[0],
|
|
54
|
+
setPasswordToShort = _useState10[1];
|
|
55
|
+
|
|
56
|
+
var _useState11 = (0, _react.useState)(false),
|
|
57
|
+
_useState12 = (0, _slicedToArray2.default)(_useState11, 2),
|
|
58
|
+
showErrors = _useState12[0],
|
|
59
|
+
setShowErrors = _useState12[1];
|
|
60
|
+
|
|
61
|
+
var _useState13 = (0, _react.useState)(false),
|
|
62
|
+
_useState14 = (0, _slicedToArray2.default)(_useState13, 2),
|
|
63
|
+
privacyCheck = _useState14[0],
|
|
64
|
+
setPrivacyCheck = _useState14[1];
|
|
65
|
+
|
|
66
|
+
var _useState15 = (0, _react.useState)(false),
|
|
67
|
+
_useState16 = (0, _slicedToArray2.default)(_useState15, 2),
|
|
68
|
+
termsCheck = _useState16[0],
|
|
69
|
+
setTermsCheck = _useState16[1];
|
|
70
|
+
|
|
71
|
+
var _useState17 = (0, _react.useState)(false),
|
|
72
|
+
_useState18 = (0, _slicedToArray2.default)(_useState17, 2),
|
|
73
|
+
emptyPassword = _useState18[0],
|
|
74
|
+
setEmptyPassword = _useState18[1];
|
|
75
|
+
|
|
76
|
+
var _useState19 = (0, _react.useState)(false),
|
|
77
|
+
_useState20 = (0, _slicedToArray2.default)(_useState19, 2),
|
|
78
|
+
emptyConfirmPassword = _useState20[0],
|
|
79
|
+
setEmptyConfirmPassword = _useState20[1];
|
|
80
|
+
|
|
81
|
+
var _useState21 = (0, _react.useState)(true),
|
|
82
|
+
_useState22 = (0, _slicedToArray2.default)(_useState21, 2),
|
|
83
|
+
matchPasswords = _useState22[0],
|
|
84
|
+
setMatchPasswords = _useState22[1];
|
|
85
|
+
|
|
86
|
+
var nuevoUsuario = JSON.parse(sessionStorage.getItem("nuevoRegistro"));
|
|
87
|
+
var upperCaseLetters = /[A-Z]/g;
|
|
88
|
+
var numbers = /[0-9]/g;
|
|
89
|
+
var specialChar = /['!','@','#','$','%','^','&','*']/g; // on passwordFinal update
|
|
90
|
+
|
|
91
|
+
(0, _react.useEffect)(function () {
|
|
92
|
+
passwordFinal === repeatedPassword ? setPasswordMatches(true) : setPasswordMatches(false);
|
|
93
|
+
passwordFinal.length < 8 ? setPasswordToShort(true) : setPasswordToShort(false);
|
|
94
|
+
}, [passwordFinal, repeatedPassword]); // on repeatedPassword update
|
|
95
|
+
|
|
96
|
+
(0, _react.useEffect)(function () {
|
|
97
|
+
passwordFinal === repeatedPassword ? setPasswordMatches(true) : setPasswordMatches(false);
|
|
98
|
+
repeatedPassword === "" ? setEmptyConfirmPassword(true) : setEmptyConfirmPassword(false);
|
|
99
|
+
}, [passwordFinal, repeatedPassword]);
|
|
100
|
+
|
|
101
|
+
var updateInfo = function updateInfo(e, newValue) {
|
|
102
|
+
e.preventDefault();
|
|
103
|
+
var password = document.querySelector("#newPasswordInput").value;
|
|
104
|
+
password.length < 8 ? setEmptyPassword(true) : setEmptyPassword(false);
|
|
105
|
+
var confirmPassword = document.querySelector("#confirmPasswordInput").value;
|
|
106
|
+
confirmPassword === "" ? setEmptyConfirmPassword(true) : setEmptyConfirmPassword(false);
|
|
107
|
+
|
|
108
|
+
if (password === confirmPassword) {
|
|
109
|
+
setMatchPasswords(true);
|
|
110
|
+
} else {
|
|
111
|
+
setMatchPasswords(false);
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
switch (e.target.id) {
|
|
115
|
+
case "passwordInput":
|
|
116
|
+
setPasswordStrenght(0);
|
|
117
|
+
|
|
118
|
+
if (newValue.length > 8) {
|
|
119
|
+
setPasswordStrenght(function (passwordStrenght) {
|
|
120
|
+
return passwordStrenght + 1;
|
|
121
|
+
});
|
|
122
|
+
} //Verificar si la contraseña contiene mayuscula, numeros y un caracter especial
|
|
123
|
+
|
|
124
|
+
|
|
125
|
+
newValue.match(upperCaseLetters) && setPasswordStrenght(function (passwordStrenght) {
|
|
126
|
+
return passwordStrenght + 1;
|
|
127
|
+
});
|
|
128
|
+
newValue.match(numbers) && setPasswordStrenght(function (passwordStrenght) {
|
|
129
|
+
return passwordStrenght + 1;
|
|
130
|
+
});
|
|
131
|
+
newValue.match(specialChar) && setPasswordStrenght(function (passwordStrenght) {
|
|
132
|
+
return passwordStrenght + 1;
|
|
133
|
+
}); //Actualizar value de la contraseña y guardar en sessionStorage
|
|
134
|
+
|
|
135
|
+
setPasswordFinal(newValue);
|
|
136
|
+
nuevoUsuario.password = newValue;
|
|
137
|
+
sessionStorage.setItem("nuevoRegistro", JSON.stringify(nuevoUsuario));
|
|
138
|
+
break;
|
|
139
|
+
|
|
140
|
+
case "confirmPasswordInput":
|
|
141
|
+
setRepeatedPassword(newValue);
|
|
142
|
+
break;
|
|
143
|
+
|
|
144
|
+
default:
|
|
145
|
+
return;
|
|
146
|
+
}
|
|
147
|
+
};
|
|
148
|
+
|
|
149
|
+
var validateForm = function validateForm(evt) {
|
|
150
|
+
evt.preventDefault();
|
|
151
|
+
setShowErrors(true);
|
|
152
|
+
var valid = true;
|
|
153
|
+
passwordToShort && (valid = false);
|
|
154
|
+
emptyConfirmPassword && (valid = false);
|
|
155
|
+
!passwordMatches && (valid = false);
|
|
156
|
+
!termsCheck && (valid = false);
|
|
157
|
+
!privacyCheck && (valid = false);
|
|
158
|
+
valid && props.setPaso(3);
|
|
159
|
+
};
|
|
81
160
|
|
|
82
161
|
var loginRight = [/*#__PURE__*/(0, _jsxRuntime.jsx)(_LogoImage.LogoImage, {}, "1"), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
83
162
|
className: "credenciales",
|
|
@@ -90,7 +169,11 @@ var RegistrationSecondStep = function RegistrationSecondStep() {
|
|
|
90
169
|
emptyPassword: emptyPassword,
|
|
91
170
|
emptyConfirmPassword: emptyConfirmPassword,
|
|
92
171
|
matchPasswords: matchPasswords,
|
|
93
|
-
textTittle: "Ingresa tus credenciales"
|
|
172
|
+
textTittle: "Ingresa tus credenciales",
|
|
173
|
+
onChange: function onChange(e) {
|
|
174
|
+
return updateInfo(e, e.target.value);
|
|
175
|
+
},
|
|
176
|
+
required: "required"
|
|
94
177
|
}, "3"), /*#__PURE__*/(0, _jsxRuntime.jsx)("label", {
|
|
95
178
|
className: "label-terms",
|
|
96
179
|
children: "T\xE9rminos y condiciones"
|
|
@@ -284,7 +284,7 @@ var SignInLogin = function SignInLogin(props) {
|
|
|
284
284
|
})
|
|
285
285
|
})]
|
|
286
286
|
})
|
|
287
|
-
}), upgradePlanRedirect && /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactRouterDom.
|
|
287
|
+
}), upgradePlanRedirect && /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactRouterDom.Redirect, {
|
|
288
288
|
to: {
|
|
289
289
|
pathname: "/dashboard"
|
|
290
290
|
}
|
|
@@ -18,7 +18,10 @@ var TagAndInput = function TagAndInput(_ref) {
|
|
|
18
18
|
label = _ref.label,
|
|
19
19
|
value = _ref.value,
|
|
20
20
|
inputPlaceHolder = _ref.inputPlaceHolder,
|
|
21
|
-
inputId = _ref.inputId
|
|
21
|
+
inputId = _ref.inputId,
|
|
22
|
+
required = _ref.required,
|
|
23
|
+
onChange = _ref.onChange,
|
|
24
|
+
defaultValue = _ref.defaultValue;
|
|
22
25
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_styles.Container, {
|
|
23
26
|
inputType: inputType,
|
|
24
27
|
className: "input-container",
|
|
@@ -29,7 +32,10 @@ var TagAndInput = function TagAndInput(_ref) {
|
|
|
29
32
|
inputId: inputId,
|
|
30
33
|
inputType: inputType,
|
|
31
34
|
inputValue: value,
|
|
32
|
-
inputPlaceholder: inputPlaceHolder
|
|
35
|
+
inputPlaceholder: inputPlaceHolder,
|
|
36
|
+
required: required,
|
|
37
|
+
onChange: onChange,
|
|
38
|
+
defaultValue: defaultValue
|
|
33
39
|
})]
|
|
34
40
|
}, "generalTagInput-".concat(inputType));
|
|
35
41
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "contentoh-components-library",
|
|
3
|
-
"version": "21.0.
|
|
3
|
+
"version": "21.0.39",
|
|
4
4
|
"dependencies": {
|
|
5
5
|
"@aws-amplify/auth": "^4.5.3",
|
|
6
6
|
"@aws-amplify/datastore": "^3.11.0",
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
"react-chartjs-2": "^4.1.0",
|
|
22
22
|
"react-dom": "^17.0.2",
|
|
23
23
|
"react-image-fallback": "^8.0.0",
|
|
24
|
-
"react-router-dom": "^
|
|
24
|
+
"react-router-dom": "^5.2.0",
|
|
25
25
|
"styled-components": "^5.3.3",
|
|
26
26
|
"web-vitals": "^1.0.1"
|
|
27
27
|
},
|
|
@@ -14,6 +14,9 @@ export const GeneralInput = ({
|
|
|
14
14
|
inputsArray,
|
|
15
15
|
maxLength,
|
|
16
16
|
inputSize,
|
|
17
|
+
onChange,
|
|
18
|
+
required,
|
|
19
|
+
defaultValue,
|
|
17
20
|
}) => {
|
|
18
21
|
const [textValue, setTextValue] = useState({ value: inputValue ?? "" });
|
|
19
22
|
|
|
@@ -42,6 +45,9 @@ export const GeneralInput = ({
|
|
|
42
45
|
value={textValue.value}
|
|
43
46
|
onInput={(e) => onHandleChange(e)}
|
|
44
47
|
maxLength={maxLength && maxLength}
|
|
48
|
+
onChange={onChange}
|
|
49
|
+
required={required}
|
|
50
|
+
defaultValue={defaultValue}
|
|
45
51
|
/>
|
|
46
52
|
) : (
|
|
47
53
|
<textarea
|
|
@@ -5,13 +5,13 @@ export const Container = styled.div`
|
|
|
5
5
|
justify-content: center;
|
|
6
6
|
align-items: center;
|
|
7
7
|
height: 100%;
|
|
8
|
-
width:
|
|
8
|
+
width: 50%;
|
|
9
9
|
.loader {
|
|
10
10
|
display: flex;
|
|
11
11
|
justify-content: center;
|
|
12
12
|
align-items: center;
|
|
13
13
|
height: 100%;
|
|
14
|
-
width:
|
|
14
|
+
width: 50%;
|
|
15
15
|
span {
|
|
16
16
|
display: inline-block;
|
|
17
17
|
border-radius: 100%;
|
|
@@ -6,13 +6,13 @@ import { ScreenHeader } from "../../atoms/ScreenHeader";
|
|
|
6
6
|
import { GlobalColors, FontFamily } from "../../../global-files/variables";
|
|
7
7
|
import { TagAndInput } from "../../molecules/TagAndInput";
|
|
8
8
|
import { Button } from "../../atoms/GeneralButton";
|
|
9
|
-
import { Auth } from "aws-amplify";
|
|
10
9
|
|
|
11
10
|
export const EmailResetPasswordLogin = (props) => {
|
|
12
11
|
const [emptyEmail, setEmptyEmail] = useState(false);
|
|
13
12
|
const [invalidEmail, setInvalidEmail] = useState(false);
|
|
14
13
|
const [showErrors, setShowErrors] = useState(false);
|
|
15
14
|
const [awsError, setAwsError] = useState("");
|
|
15
|
+
|
|
16
16
|
const validate = async (e) => {
|
|
17
17
|
let valid = true;
|
|
18
18
|
setShowErrors(true);
|
|
@@ -29,7 +29,7 @@ export const EmailResetPasswordLogin = (props) => {
|
|
|
29
29
|
|
|
30
30
|
if (valid) {
|
|
31
31
|
try {
|
|
32
|
-
await Auth.forgotPassword(email);
|
|
32
|
+
await props.Auth.forgotPassword(email);
|
|
33
33
|
sessionStorage.setItem("email", JSON.stringify(email));
|
|
34
34
|
sessionStorage.setItem("resetPasswordProcess", JSON.stringify("true"));
|
|
35
35
|
props.setPaso(5);
|
|
@@ -1,15 +1,19 @@
|
|
|
1
1
|
import { Container, ItemPasswordStrength, Password } from "./styles";
|
|
2
2
|
import { useEffect, useState } from "react";
|
|
3
3
|
import { TagAndInput } from "../TagAndInput";
|
|
4
|
+
|
|
4
5
|
export const LoginPasswordStrength = ({
|
|
5
6
|
emptyPassword,
|
|
6
7
|
emptyConfirmPassword,
|
|
7
8
|
matchPasswords,
|
|
9
|
+
onChange,
|
|
10
|
+
required,
|
|
8
11
|
}) => {
|
|
9
12
|
const [passwordStrength, setPasswordStrength] = useState(0);
|
|
10
13
|
let upperCaseLetters = /[A-Z]/g;
|
|
11
14
|
let numbers = /[0-9]/g;
|
|
12
15
|
let specialChar = /[‘!’,‘@’,‘#’,‘$’,‘%’,‘^’,‘&’,‘*’]/g;
|
|
16
|
+
|
|
13
17
|
useEffect(() => {
|
|
14
18
|
const inputValue = document.getElementById("newPasswordInput");
|
|
15
19
|
inputValue.addEventListener(
|
|
@@ -20,6 +24,7 @@ export const LoginPasswordStrength = ({
|
|
|
20
24
|
false
|
|
21
25
|
);
|
|
22
26
|
}, []);
|
|
27
|
+
|
|
23
28
|
const updateInfo = (e, newValue) => {
|
|
24
29
|
switch (e.target.id) {
|
|
25
30
|
case "newPasswordInput":
|
|
@@ -41,6 +46,7 @@ export const LoginPasswordStrength = ({
|
|
|
41
46
|
return;
|
|
42
47
|
}
|
|
43
48
|
};
|
|
49
|
+
|
|
44
50
|
return (
|
|
45
51
|
<Container>
|
|
46
52
|
<div className="user" key={"3"}>
|
|
@@ -48,6 +54,8 @@ export const LoginPasswordStrength = ({
|
|
|
48
54
|
inputType={"password"}
|
|
49
55
|
inputId={"newPasswordInput"}
|
|
50
56
|
label={"Ingrese su nueva contraseña"}
|
|
57
|
+
required={required}
|
|
58
|
+
onChange={onChange}
|
|
51
59
|
/>
|
|
52
60
|
{emptyPassword && (
|
|
53
61
|
<label>La contraseña debe ser minimo de 8 caracteres</label>
|
|
@@ -76,6 +84,8 @@ export const LoginPasswordStrength = ({
|
|
|
76
84
|
inputType={"password"}
|
|
77
85
|
inputId={"confirmPasswordInput"}
|
|
78
86
|
label={"Confirme la nueva contraseña"}
|
|
87
|
+
required={required}
|
|
88
|
+
onChange={onChange}
|
|
79
89
|
/>
|
|
80
90
|
{emptyConfirmPassword && !emptyPassword && (
|
|
81
91
|
<label>Confirme la contraseña</label>
|
|
@@ -86,4 +96,4 @@ export const LoginPasswordStrength = ({
|
|
|
86
96
|
</div>
|
|
87
97
|
</Container>
|
|
88
98
|
);
|
|
89
|
-
};
|
|
99
|
+
};
|
|
@@ -37,17 +37,6 @@ export const RegistrationFirstStep = (props) => {
|
|
|
37
37
|
sessionStorage.getItem("resetPasswordProcess");
|
|
38
38
|
}, []);
|
|
39
39
|
|
|
40
|
-
let paisesEsp = [
|
|
41
|
-
"Argentina",
|
|
42
|
-
"Colombia",
|
|
43
|
-
"Costa Rica",
|
|
44
|
-
"Ecuador",
|
|
45
|
-
"El Salvador",
|
|
46
|
-
"Honduras",
|
|
47
|
-
"México",
|
|
48
|
-
"Panamá",
|
|
49
|
-
"Perú",
|
|
50
|
-
];
|
|
51
40
|
const updateInfo = (e, newValue) => {
|
|
52
41
|
let nuevoUsuario = JSON.parse(sessionStorage.getItem("nuevoRegistro"));
|
|
53
42
|
switch (e.target.id) {
|
|
@@ -142,7 +131,7 @@ export const RegistrationFirstStep = (props) => {
|
|
|
142
131
|
defaultValue={
|
|
143
132
|
JSON.parse(sessionStorage.getItem("nuevoRegistro")).name
|
|
144
133
|
}
|
|
145
|
-
required
|
|
134
|
+
required={"required"}
|
|
146
135
|
onInput={(e) => updateInfo(e, e.target.value)}
|
|
147
136
|
/>
|
|
148
137
|
<TagAndInput
|
|
@@ -150,25 +139,46 @@ export const RegistrationFirstStep = (props) => {
|
|
|
150
139
|
inputId={"lastNameInput"}
|
|
151
140
|
label={"Apellido"}
|
|
152
141
|
inputPlaceHolder={"Apellido"}
|
|
142
|
+
defaultValue={
|
|
143
|
+
JSON.parse(sessionStorage.getItem("nuevoRegistro")).lastName
|
|
144
|
+
}
|
|
145
|
+
required={"required"}
|
|
146
|
+
onChange={(e) => updateInfo(e, e.target.value)}
|
|
153
147
|
/>
|
|
154
148
|
</div>
|
|
155
|
-
{emptyName && <label>Ingrese su nombre</label>}
|
|
156
|
-
{emptyLastName && <label>Ingrese sus apellidos</label>}
|
|
149
|
+
{emptyName && showErrors && <label>Ingrese su nombre</label>}
|
|
150
|
+
{emptyLastName && showErrors && <label>Ingrese sus apellidos</label>}
|
|
157
151
|
<TagAndInput
|
|
158
152
|
inputType={"text"}
|
|
159
153
|
inputId={"emailInput"}
|
|
160
154
|
label={"Correo electrónico"}
|
|
161
155
|
inputPlaceHolder={"username@contentoh.com"}
|
|
156
|
+
required={"required"}
|
|
157
|
+
defaultValue={JSON.parse(sessionStorage.getItem("nuevoRegistro")).email}
|
|
158
|
+
id="emailInput"
|
|
159
|
+
onChange={(e) => updateInfo(e, e.target.value)}
|
|
162
160
|
/>
|
|
163
|
-
{
|
|
164
|
-
|
|
161
|
+
{regError &&
|
|
162
|
+
JSON.parse(sessionStorage.getItem("registrationError")) ===
|
|
163
|
+
"emailExists" && (
|
|
164
|
+
<label>Ya existe una cuenta asociada a este correo</label>
|
|
165
|
+
)}
|
|
166
|
+
{emptyEmail && showErrors && <label>Ingrese su email</label>}
|
|
167
|
+
{emailFormatError && showErrors && !emptyEmail && (
|
|
168
|
+
<label>Ingrese un correo válido</label>
|
|
169
|
+
)}
|
|
165
170
|
<TagAndInput
|
|
166
171
|
inputType={"text"}
|
|
167
172
|
inputId={"jobInput"}
|
|
168
173
|
label={"Puesto laboral"}
|
|
169
174
|
inputPlaceHolder={"Puesto dentro de la empresa"}
|
|
175
|
+
defaultValue={
|
|
176
|
+
JSON.parse(sessionStorage.getItem("nuevoRegistro")).position
|
|
177
|
+
}
|
|
178
|
+
required={"required"}
|
|
179
|
+
onChange={(e) => updateInfo(e, e.target.value)}
|
|
170
180
|
/>
|
|
171
|
-
{emptyJob && <label>Ingrese su puesto</label>}
|
|
181
|
+
{emptyJob && showErrors && <label>Ingrese su puesto</label>}
|
|
172
182
|
<ScreenHeader text={"Teléfono"} headerType={"input-name-header"} />
|
|
173
183
|
<div className="phone-registration-user">
|
|
174
184
|
<select name="select" className="phone-options" id="countryCodeSelect">
|
|
@@ -186,11 +196,35 @@ export const RegistrationFirstStep = (props) => {
|
|
|
186
196
|
inputId={"phoneInput"}
|
|
187
197
|
inputType={"text"}
|
|
188
198
|
inputPlaceholder={"Teléfono"}
|
|
199
|
+
defaultValue={
|
|
200
|
+
//phone without countryCode
|
|
201
|
+
JSON.parse(sessionStorage.getItem("nuevoRegistro")).phone.substring(
|
|
202
|
+
JSON.parse(sessionStorage.getItem("countryCode")).length,
|
|
203
|
+
JSON.parse(sessionStorage.getItem("nuevoRegistro")).phone.length -
|
|
204
|
+
1
|
|
205
|
+
)
|
|
206
|
+
}
|
|
207
|
+
required={"required"}
|
|
208
|
+
onChange={(e) => updateInfo(e, e.target.value)}
|
|
189
209
|
/>
|
|
190
210
|
</div>
|
|
191
|
-
{
|
|
211
|
+
{regError &&
|
|
212
|
+
JSON.parse(sessionStorage.getItem("registrationError")) ===
|
|
213
|
+
"phoneFormatError" && <label>Introduzca un número válido</label>}
|
|
214
|
+
{emptyPhone && showErrors && <label>Ingrese su número de teléfono</label>}
|
|
215
|
+
{phoneFormatError && showErrors && (
|
|
216
|
+
<label>Introduzca un número valido ( Solo numeros )</label>
|
|
217
|
+
)}
|
|
192
218
|
<ScreenHeader text={"País"} headerType={"input-name-header"} />
|
|
193
|
-
<select
|
|
219
|
+
<select
|
|
220
|
+
name="select"
|
|
221
|
+
className="country-options"
|
|
222
|
+
id="countrySelect"
|
|
223
|
+
defaultValue={
|
|
224
|
+
JSON.parse(sessionStorage.getItem("nuevoRegistro")).country
|
|
225
|
+
}
|
|
226
|
+
onChange={(e) => updateInfo(e, e.target.value)}
|
|
227
|
+
>
|
|
194
228
|
<option value="value1" selected>
|
|
195
229
|
Selecciona tu país
|
|
196
230
|
</option>
|
|
@@ -203,13 +237,13 @@ export const RegistrationFirstStep = (props) => {
|
|
|
203
237
|
<option value="value2">Panamá</option>
|
|
204
238
|
<option value="value3">Perú</option>
|
|
205
239
|
</select>
|
|
206
|
-
{emptyEmail && <label>Seleccione su país</label>}
|
|
240
|
+
{emptyEmail && showErrors && <label>Seleccione su país</label>}
|
|
207
241
|
</div>,
|
|
208
242
|
<div className="button-end" key="4">
|
|
209
243
|
<Button
|
|
210
244
|
buttonType={"general-default-button"}
|
|
211
245
|
label={"Enviar"}
|
|
212
|
-
onClick={(e) =>
|
|
246
|
+
onClick={(e) => validateForm(e)}
|
|
213
247
|
/>
|
|
214
248
|
</div>,
|
|
215
249
|
<div className="progress-bar" key="5">
|
|
@@ -223,7 +257,7 @@ export const RegistrationFirstStep = (props) => {
|
|
|
223
257
|
key="6"
|
|
224
258
|
/>,
|
|
225
259
|
<div className="new-login" key="7">
|
|
226
|
-
<p className="pre-registro">
|
|
260
|
+
<p className="pre-registro" onClick={() => props.setPaso(7)}>
|
|
227
261
|
¿Ya tienes una cuenta?<span> Inicia Sesión</span>
|
|
228
262
|
</p>
|
|
229
263
|
</div>,
|
|
@@ -239,4 +273,4 @@ export const RegistrationFirstStep = (props) => {
|
|
|
239
273
|
</div>
|
|
240
274
|
</Container>
|
|
241
275
|
);
|
|
242
|
-
};
|
|
276
|
+
};
|
|
@@ -1,17 +1,52 @@
|
|
|
1
1
|
import { Container } from "./styles";
|
|
2
2
|
import { GradientPanel } from "../../atoms/GradientPanel";
|
|
3
|
-
import { useState } from "react";
|
|
3
|
+
import { useState, useEffect } from "react";
|
|
4
4
|
import { ScreenHeader } from "../../atoms/ScreenHeader";
|
|
5
5
|
import { GlobalColors, FontFamily } from "../../../global-files/variables";
|
|
6
6
|
import { Button } from "../../atoms/GeneralButton";
|
|
7
7
|
import { LoginPasswordStrength } from "../../molecules/LoginPasswordStrength";
|
|
8
8
|
import { LogoImage } from "../../atoms/LogoImage";
|
|
9
9
|
|
|
10
|
-
export const RegistrationSecondStep = () => {
|
|
10
|
+
export const RegistrationSecondStep = (props) => {
|
|
11
|
+
const [passwordStrength, setPasswordStrenght] = useState(0);
|
|
12
|
+
const [passwordFinal, setPasswordFinal] = useState("");
|
|
13
|
+
const [repeatedPassword, setRepeatedPassword] = useState("");
|
|
14
|
+
const [passwordMatches, setPasswordMatches] = useState(false);
|
|
15
|
+
const [passwordToShort, setPasswordToShort] = useState(true);
|
|
16
|
+
const [showErrors, setShowErrors] = useState(false);
|
|
17
|
+
const [privacyCheck, setPrivacyCheck] = useState(false);
|
|
18
|
+
const [termsCheck, setTermsCheck] = useState(false);
|
|
19
|
+
|
|
11
20
|
const [emptyPassword, setEmptyPassword] = useState(false);
|
|
12
21
|
const [emptyConfirmPassword, setEmptyConfirmPassword] = useState(false);
|
|
13
22
|
const [matchPasswords, setMatchPasswords] = useState(true);
|
|
14
|
-
|
|
23
|
+
|
|
24
|
+
let nuevoUsuario = JSON.parse(sessionStorage.getItem("nuevoRegistro"));
|
|
25
|
+
let upperCaseLetters = /[A-Z]/g;
|
|
26
|
+
let numbers = /[0-9]/g;
|
|
27
|
+
let specialChar = /['!','@','#','$','%','^','&','*']/g;
|
|
28
|
+
|
|
29
|
+
// on passwordFinal update
|
|
30
|
+
useEffect(() => {
|
|
31
|
+
passwordFinal === repeatedPassword
|
|
32
|
+
? setPasswordMatches(true)
|
|
33
|
+
: setPasswordMatches(false);
|
|
34
|
+
passwordFinal.length < 8
|
|
35
|
+
? setPasswordToShort(true)
|
|
36
|
+
: setPasswordToShort(false);
|
|
37
|
+
}, [passwordFinal, repeatedPassword]);
|
|
38
|
+
|
|
39
|
+
// on repeatedPassword update
|
|
40
|
+
useEffect(() => {
|
|
41
|
+
passwordFinal === repeatedPassword
|
|
42
|
+
? setPasswordMatches(true)
|
|
43
|
+
: setPasswordMatches(false);
|
|
44
|
+
repeatedPassword === ""
|
|
45
|
+
? setEmptyConfirmPassword(true)
|
|
46
|
+
: setEmptyConfirmPassword(false);
|
|
47
|
+
}, [passwordFinal, repeatedPassword]);
|
|
48
|
+
|
|
49
|
+
const updateInfo = (e, newValue) => {
|
|
15
50
|
e.preventDefault();
|
|
16
51
|
const password = document.querySelector("#newPasswordInput").value;
|
|
17
52
|
password.length < 8 ? setEmptyPassword(true) : setEmptyPassword(false);
|
|
@@ -26,7 +61,43 @@ export const RegistrationSecondStep = () => {
|
|
|
26
61
|
} else {
|
|
27
62
|
setMatchPasswords(false);
|
|
28
63
|
}
|
|
64
|
+
switch (e.target.id) {
|
|
65
|
+
case "passwordInput":
|
|
66
|
+
setPasswordStrenght(0);
|
|
67
|
+
if (newValue.length > 8) {
|
|
68
|
+
setPasswordStrenght((passwordStrenght) => passwordStrenght + 1);
|
|
69
|
+
}
|
|
70
|
+
//Verificar si la contraseña contiene mayuscula, numeros y un caracter especial
|
|
71
|
+
newValue.match(upperCaseLetters) &&
|
|
72
|
+
setPasswordStrenght((passwordStrenght) => passwordStrenght + 1);
|
|
73
|
+
newValue.match(numbers) &&
|
|
74
|
+
setPasswordStrenght((passwordStrenght) => passwordStrenght + 1);
|
|
75
|
+
newValue.match(specialChar) &&
|
|
76
|
+
setPasswordStrenght((passwordStrenght) => passwordStrenght + 1);
|
|
77
|
+
//Actualizar value de la contraseña y guardar en sessionStorage
|
|
78
|
+
setPasswordFinal(newValue);
|
|
79
|
+
nuevoUsuario.password = newValue;
|
|
80
|
+
sessionStorage.setItem("nuevoRegistro", JSON.stringify(nuevoUsuario));
|
|
81
|
+
break;
|
|
82
|
+
case "confirmPasswordInput":
|
|
83
|
+
setRepeatedPassword(newValue);
|
|
84
|
+
break;
|
|
85
|
+
default:
|
|
86
|
+
return;
|
|
87
|
+
}
|
|
88
|
+
};
|
|
89
|
+
const validateForm = (evt) => {
|
|
90
|
+
evt.preventDefault();
|
|
91
|
+
setShowErrors(true);
|
|
92
|
+
let valid = true;
|
|
93
|
+
passwordToShort && (valid = false);
|
|
94
|
+
emptyConfirmPassword && (valid = false);
|
|
95
|
+
!passwordMatches && (valid = false);
|
|
96
|
+
!termsCheck && (valid = false);
|
|
97
|
+
!privacyCheck && (valid = false);
|
|
98
|
+
valid && props.setPaso(3);
|
|
29
99
|
};
|
|
100
|
+
|
|
30
101
|
const loginRight = [
|
|
31
102
|
<LogoImage key="1" />,
|
|
32
103
|
<div className="credenciales" key={"2"}>
|
|
@@ -42,6 +113,8 @@ export const RegistrationSecondStep = () => {
|
|
|
42
113
|
emptyConfirmPassword={emptyConfirmPassword}
|
|
43
114
|
matchPasswords={matchPasswords}
|
|
44
115
|
textTittle={"Ingresa tus credenciales"}
|
|
116
|
+
onChange={(e) => updateInfo(e, e.target.value)}
|
|
117
|
+
required={"required"}
|
|
45
118
|
/>,
|
|
46
119
|
<label className="label-terms" key={"4"}>Términos y condiciones</label>,
|
|
47
120
|
<div className="checkbox-terms" key={"5"}>
|
|
@@ -7,7 +7,7 @@ import { TagAndInput } from "../TagAndInput";
|
|
|
7
7
|
import { FontFamily, GlobalColors } from "../../../global-files/variables";
|
|
8
8
|
import { useState, useEffect } from "react";
|
|
9
9
|
import { Loading } from "../../atoms/Loading";
|
|
10
|
-
import {
|
|
10
|
+
import { Redirect } from "react-router-dom";
|
|
11
11
|
import axios from "axios";
|
|
12
12
|
|
|
13
13
|
export const SignInLogin = (props) => {
|
|
@@ -203,7 +203,7 @@ export const SignInLogin = (props) => {
|
|
|
203
203
|
</div>
|
|
204
204
|
</div>
|
|
205
205
|
</Container>
|
|
206
|
-
{upgradePlanRedirect && <
|
|
206
|
+
{upgradePlanRedirect && <Redirect to={{ pathname: "/dashboard" }} />}
|
|
207
207
|
</>
|
|
208
208
|
);
|
|
209
209
|
};
|
|
@@ -8,6 +8,9 @@ export const TagAndInput = ({
|
|
|
8
8
|
value,
|
|
9
9
|
inputPlaceHolder,
|
|
10
10
|
inputId,
|
|
11
|
+
required,
|
|
12
|
+
onChange,
|
|
13
|
+
defaultValue,
|
|
11
14
|
}) => {
|
|
12
15
|
return (
|
|
13
16
|
<Container
|
|
@@ -21,6 +24,9 @@ export const TagAndInput = ({
|
|
|
21
24
|
inputType={inputType}
|
|
22
25
|
inputValue={value}
|
|
23
26
|
inputPlaceholder={inputPlaceHolder}
|
|
27
|
+
required={required}
|
|
28
|
+
onChange={onChange}
|
|
29
|
+
defaultValue={defaultValue}
|
|
24
30
|
/>
|
|
25
31
|
</Container>
|
|
26
32
|
);
|