contentoh-components-library 21.0.38 → 21.0.41
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 +2 -6
- package/dist/components/atoms/GradientPanel/styles.js +1 -1
- package/dist/components/atoms/Loading/index.js +5 -3
- package/dist/components/atoms/Loading/styles.js +1 -1
- package/dist/components/molecules/LoginPasswordStrength/index.js +2 -8
- package/dist/components/molecules/RegistrationFirstStep/index.js +77 -135
- package/dist/components/molecules/RegistrationFirstStep/styles.js +1 -1
- package/dist/components/molecules/RegistrationSecondStep/index.js +43 -111
- package/dist/components/molecules/RegistrationThirdStep/index.js +19 -33
- package/dist/components/molecules/SignInLogin/styles.js +1 -1
- package/dist/components/molecules/TagAndInput/index.js +2 -6
- package/dist/components/molecules/VerificationCodeResetPasswordLogin/index.js +115 -9
- package/dist/components/molecules/VerificationCodeResetPasswordLogin/utils.js +2 -2
- package/dist/components/organisms/ChangePassword/index.js +13 -3
- package/dist/components/organisms/ChangePassword/styles.js +1 -1
- package/package.json +2 -2
- package/src/components/atoms/GeneralInput/index.js +0 -4
- package/src/components/atoms/GradientPanel/styles.js +1 -0
- package/src/components/atoms/Loading/index.js +2 -0
- package/src/components/atoms/Loading/styles.js +12 -3
- package/src/components/molecules/EmailResetPasswordLogin/index.js +0 -1
- package/src/components/molecules/LoginPasswordStrength/index.js +0 -5
- package/src/components/molecules/RegistrationFirstStep/index.js +95 -141
- package/src/components/molecules/RegistrationFirstStep/styles.js +4 -1
- package/src/components/molecules/RegistrationSecondStep/index.js +52 -87
- package/src/components/molecules/RegistrationThirdStep/index.js +14 -1
- package/src/components/molecules/SignInLogin/styles.js +1 -0
- package/src/components/molecules/TagAndInput/index.js +0 -4
- package/src/components/molecules/VerificationCodeResetPasswordLogin/index.js +103 -11
- package/src/components/molecules/VerificationCodeResetPasswordLogin/utils.js +2 -4
- package/src/components/organisms/ChangePassword/index.js +16 -3
- package/src/components/organisms/ChangePassword/styles.js +2 -2
|
@@ -6,7 +6,6 @@ export const LoginPasswordStrength = ({
|
|
|
6
6
|
emptyPassword,
|
|
7
7
|
emptyConfirmPassword,
|
|
8
8
|
matchPasswords,
|
|
9
|
-
onChange,
|
|
10
9
|
required,
|
|
11
10
|
}) => {
|
|
12
11
|
const [passwordStrength, setPasswordStrength] = useState(0);
|
|
@@ -40,8 +39,6 @@ export const LoginPasswordStrength = ({
|
|
|
40
39
|
newValue.match(specialChar) &&
|
|
41
40
|
setPasswordStrength((passwordStrength) => passwordStrength + 1);
|
|
42
41
|
break;
|
|
43
|
-
case "confirmPasswordInput":
|
|
44
|
-
break;
|
|
45
42
|
default:
|
|
46
43
|
return;
|
|
47
44
|
}
|
|
@@ -55,7 +52,6 @@ export const LoginPasswordStrength = ({
|
|
|
55
52
|
inputId={"newPasswordInput"}
|
|
56
53
|
label={"Ingrese su nueva contraseña"}
|
|
57
54
|
required={required}
|
|
58
|
-
onChange={onChange}
|
|
59
55
|
/>
|
|
60
56
|
{emptyPassword && (
|
|
61
57
|
<label>La contraseña debe ser minimo de 8 caracteres</label>
|
|
@@ -85,7 +81,6 @@ export const LoginPasswordStrength = ({
|
|
|
85
81
|
inputId={"confirmPasswordInput"}
|
|
86
82
|
label={"Confirme la nueva contraseña"}
|
|
87
83
|
required={required}
|
|
88
|
-
onChange={onChange}
|
|
89
84
|
/>
|
|
90
85
|
{emptyConfirmPassword && !emptyPassword && (
|
|
91
86
|
<label>Confirme la contraseña</label>
|
|
@@ -14,11 +14,10 @@ export const RegistrationFirstStep = (props) => {
|
|
|
14
14
|
const [emptyEmail, setEmptyEmail] = useState(false);
|
|
15
15
|
const [emptyJob, setEmptyJob] = useState(false);
|
|
16
16
|
const [emptyPhone, setEmptyPhone] = useState(false);
|
|
17
|
-
const [emptyCountry, setEmptyCountry] = useState(
|
|
18
|
-
const [
|
|
19
|
-
const [regError, setRegError] = useState(false);
|
|
17
|
+
const [emptyCountry, setEmptyCountry] = useState(false);
|
|
18
|
+
const [invalidEmail, setInvalidEmail] = useState(false);
|
|
20
19
|
const [phoneFormatError, setPhoneFormatError] = useState(false);
|
|
21
|
-
const [
|
|
20
|
+
const [regError, setRegError] = useState(false);
|
|
22
21
|
|
|
23
22
|
useEffect(() => {
|
|
24
23
|
JSON.parse(sessionStorage.getItem("nuevoRegistro")).name === "" &&
|
|
@@ -32,86 +31,74 @@ export const RegistrationFirstStep = (props) => {
|
|
|
32
31
|
setEmptyCountry(false);
|
|
33
32
|
setEmptyPhone(false);
|
|
34
33
|
}
|
|
35
|
-
|
|
36
34
|
sessionStorage.getItem("resetPasswordProcess") &&
|
|
37
35
|
sessionStorage.getItem("resetPasswordProcess");
|
|
38
36
|
}, []);
|
|
37
|
+
const validate = (evt) => {
|
|
38
|
+
let valid = true;
|
|
39
|
+
evt.preventDefault();
|
|
40
|
+
const name = document.querySelector("#nameInput").value;
|
|
41
|
+
const lastName = document.querySelector("#lastNameInput").value;
|
|
42
|
+
const email = document.querySelector("#emailInput").value;
|
|
43
|
+
const job = document.querySelector("#jobInput").value;
|
|
44
|
+
const phone = document.querySelector("#phoneInput").value;
|
|
45
|
+
const country = document.querySelector("#countrySelect").value;
|
|
46
|
+
name === "" ? setEmptyName(true) : setEmptyName(false);
|
|
47
|
+
lastName === "" ? setEmptyLastName(true) : setEmptyLastName(false);
|
|
48
|
+
email === "" ? setEmptyEmail(true) : setEmptyEmail(false);
|
|
49
|
+
job === "" ? setEmptyJob(true) : setEmptyJob(false);
|
|
50
|
+
phone === "" ? setEmptyPhone(true) : setEmptyPhone(false);
|
|
51
|
+
!/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9-]+(?:\.[a-zA-Z0-9-]+)*$/.test(
|
|
52
|
+
email
|
|
53
|
+
)
|
|
54
|
+
? setInvalidEmail(true)
|
|
55
|
+
: setInvalidEmail(false);
|
|
56
|
+
let invalidPhone = true;
|
|
57
|
+
country === "value" ? setEmptyCountry(true) : setEmptyCountry(false);
|
|
58
|
+
Array.from(phone).forEach((digit, i) => {
|
|
59
|
+
phone.charCodeAt(i) < 48
|
|
60
|
+
? setPhoneFormatError(true)
|
|
61
|
+
: (invalidPhone = false);
|
|
62
|
+
phone.charCodeAt(i) > 57
|
|
63
|
+
? setPhoneFormatError(true)
|
|
64
|
+
: (invalidPhone = false);
|
|
65
|
+
});
|
|
66
|
+
if (
|
|
67
|
+
name === "" ||
|
|
68
|
+
lastName === "" ||
|
|
69
|
+
email === "" ||
|
|
70
|
+
job === "" ||
|
|
71
|
+
phone === "" ||
|
|
72
|
+
country === "value" ||
|
|
73
|
+
!/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9-]+(?:\.[a-zA-Z0-9-]+)*$/.test(
|
|
74
|
+
email
|
|
75
|
+
) ||
|
|
76
|
+
invalidPhone
|
|
77
|
+
) {
|
|
78
|
+
valid = false;
|
|
79
|
+
} else valid = true;
|
|
39
80
|
|
|
40
|
-
|
|
81
|
+
return valid;
|
|
82
|
+
};
|
|
83
|
+
const validateForm = (evt, valid) => {
|
|
84
|
+
evt.preventDefault();
|
|
41
85
|
let nuevoUsuario = JSON.parse(sessionStorage.getItem("nuevoRegistro"));
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
!/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9-]+(?:\.[a-zA-Z0-9-]+)*$/.test(
|
|
56
|
-
newValue
|
|
57
|
-
)
|
|
58
|
-
) {
|
|
59
|
-
setEmailFormatError(true);
|
|
60
|
-
} else {
|
|
61
|
-
setEmailFormatError(false);
|
|
62
|
-
}
|
|
63
|
-
break;
|
|
64
|
-
case "jobInput":
|
|
65
|
-
nuevoUsuario.position = newValue;
|
|
66
|
-
newValue === "" ? setEmptyJob(true) : setEmptyJob(false);
|
|
67
|
-
break;
|
|
68
|
-
case "phoneInput":
|
|
69
|
-
Array.from(newValue).forEach((digit, i) => {
|
|
70
|
-
newValue.charCodeAt(i) < 48
|
|
71
|
-
? setPhoneFormatError(true)
|
|
72
|
-
: setPhoneFormatError(false);
|
|
73
|
-
newValue.charCodeAt(i) > 57
|
|
74
|
-
? setPhoneFormatError(true)
|
|
75
|
-
: setPhoneFormatError(false);
|
|
76
|
-
});
|
|
77
|
-
nuevoUsuario.phone = `${JSON.parse(
|
|
78
|
-
sessionStorage.getItem("countryCodeSelect")
|
|
79
|
-
)}${newValue}`;
|
|
80
|
-
newValue === "" ? setEmptyPhone(true) : setEmptyPhone(false);
|
|
81
|
-
break;
|
|
82
|
-
case "countrySelect":
|
|
83
|
-
nuevoUsuario.country = newValue;
|
|
84
|
-
newValue === "" || newValue === "Selecciona tu país"
|
|
85
|
-
? setEmptyCountry(true)
|
|
86
|
-
: setEmptyCountry(false);
|
|
87
|
-
break;
|
|
88
|
-
case "countryCodeSelect":
|
|
89
|
-
sessionStorage.setItem("countryCode", JSON.stringify(newValue));
|
|
90
|
-
nuevoUsuario.phone = `${JSON.parse(
|
|
91
|
-
sessionStorage.getItem("countryCode")
|
|
92
|
-
)}${document.querySelector("#phoneInput").value}`;
|
|
93
|
-
break;
|
|
94
|
-
default:
|
|
95
|
-
return;
|
|
86
|
+
if (valid) {
|
|
87
|
+
sessionStorage.setItem("countryCode", JSON.stringify(countryCode));
|
|
88
|
+
nuevoUsuario.name = name;
|
|
89
|
+
nuevoUsuario.lastName = lastName;
|
|
90
|
+
nuevoUsuario.email = email;
|
|
91
|
+
nuevoUsuario.position = job;
|
|
92
|
+
nuevoUsuario.phone = `${JSON.parse(
|
|
93
|
+
sessionStorage.getItem("countryCode")
|
|
94
|
+
)}${phone}`;
|
|
95
|
+
nuevoUsuario.country = country;
|
|
96
|
+
sessionStorage.setItem("nuevoRegistro", JSON.stringify(nuevoUsuario));
|
|
97
|
+
!regError && valid && props.setPaso((paso) => props.paso + 1);
|
|
98
|
+
regError && valid && props.setPaso(4);
|
|
96
99
|
}
|
|
97
|
-
sessionStorage.setItem("nuevoRegistro", JSON.stringify(nuevoUsuario));
|
|
98
100
|
};
|
|
99
101
|
|
|
100
|
-
const validateForm = (evt) => {
|
|
101
|
-
let valid = true;
|
|
102
|
-
evt.preventDefault();
|
|
103
|
-
setShowErrors(true);
|
|
104
|
-
emptyName && (valid = false);
|
|
105
|
-
emptyLastName && (valid = false);
|
|
106
|
-
emptyEmail && (valid = false);
|
|
107
|
-
emptyJob && (valid = false);
|
|
108
|
-
emptyPhone && (valid = false);
|
|
109
|
-
emptyCountry && (valid = false);
|
|
110
|
-
phoneFormatError && (valid = false);
|
|
111
|
-
emailFormatError && (valid = false);
|
|
112
|
-
!regError && valid && props.setPaso((paso) => props.paso + 1);
|
|
113
|
-
regError && valid && props.setPaso(4);
|
|
114
|
-
};
|
|
115
102
|
const loginRight = [
|
|
116
103
|
<LogoImage key="1" />,
|
|
117
104
|
<div className="credenciales" key={"2"}>
|
|
@@ -128,57 +115,40 @@ export const RegistrationFirstStep = (props) => {
|
|
|
128
115
|
inputId={"nameInput"}
|
|
129
116
|
label={"Nombre"}
|
|
130
117
|
inputPlaceHolder={"Nombre"}
|
|
131
|
-
|
|
132
|
-
JSON.parse(sessionStorage.getItem("nuevoRegistro")).name
|
|
133
|
-
}
|
|
134
|
-
required={required}
|
|
135
|
-
onInput={(e) => updateInfo(e, e.target.value)}
|
|
118
|
+
required={"required"}
|
|
136
119
|
/>
|
|
137
120
|
<TagAndInput
|
|
138
121
|
inputType={"text"}
|
|
139
122
|
inputId={"lastNameInput"}
|
|
140
123
|
label={"Apellido"}
|
|
141
124
|
inputPlaceHolder={"Apellido"}
|
|
142
|
-
|
|
143
|
-
JSON.parse(sessionStorage.getItem("nuevoRegistro")).lastName
|
|
144
|
-
}
|
|
145
|
-
required={required}
|
|
146
|
-
onChange={(e) => updateInfo(e, e.target.value)}
|
|
125
|
+
required={"required"}
|
|
147
126
|
/>
|
|
148
127
|
</div>
|
|
149
|
-
{emptyName &&
|
|
150
|
-
{emptyLastName &&
|
|
128
|
+
{emptyName && <label>Ingrese su nombre</label>}
|
|
129
|
+
{emptyLastName && <label>Ingrese sus apellidos</label>}
|
|
151
130
|
<TagAndInput
|
|
152
131
|
inputType={"text"}
|
|
153
132
|
inputId={"emailInput"}
|
|
154
133
|
label={"Correo electrónico"}
|
|
155
134
|
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)}
|
|
135
|
+
required={"required"}
|
|
160
136
|
/>
|
|
161
137
|
{regError &&
|
|
162
138
|
JSON.parse(sessionStorage.getItem("registrationError")) ===
|
|
163
139
|
"emailExists" && (
|
|
164
140
|
<label>Ya existe una cuenta asociada a este correo</label>
|
|
165
141
|
)}
|
|
166
|
-
{emptyEmail &&
|
|
167
|
-
{
|
|
168
|
-
<label>Ingrese un correo válido</label>
|
|
169
|
-
)}
|
|
142
|
+
{emptyEmail && <label>Ingrese su email</label>}
|
|
143
|
+
{invalidEmail && !emptyEmail && <label>Ingrese un correo válido</label>}
|
|
170
144
|
<TagAndInput
|
|
171
145
|
inputType={"text"}
|
|
172
146
|
inputId={"jobInput"}
|
|
173
147
|
label={"Puesto laboral"}
|
|
174
148
|
inputPlaceHolder={"Puesto dentro de la empresa"}
|
|
175
|
-
|
|
176
|
-
JSON.parse(sessionStorage.getItem("nuevoRegistro")).position
|
|
177
|
-
}
|
|
178
|
-
required={required}
|
|
179
|
-
onChange={(e) => updateInfo(e, e.target.value)}
|
|
149
|
+
required={"required"}
|
|
180
150
|
/>
|
|
181
|
-
{emptyJob &&
|
|
151
|
+
{emptyJob && <label>Ingrese su puesto</label>}
|
|
182
152
|
<ScreenHeader text={"Teléfono"} headerType={"input-name-header"} />
|
|
183
153
|
<div className="phone-registration-user">
|
|
184
154
|
<select name="select" className="phone-options" id="countryCodeSelect">
|
|
@@ -196,54 +166,40 @@ export const RegistrationFirstStep = (props) => {
|
|
|
196
166
|
inputId={"phoneInput"}
|
|
197
167
|
inputType={"text"}
|
|
198
168
|
inputPlaceholder={"Teléfono"}
|
|
199
|
-
|
|
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)}
|
|
169
|
+
required={"required"}
|
|
209
170
|
/>
|
|
210
171
|
</div>
|
|
211
172
|
{regError &&
|
|
212
173
|
JSON.parse(sessionStorage.getItem("registrationError")) ===
|
|
213
174
|
"phoneFormatError" && <label>Introduzca un número válido</label>}
|
|
214
|
-
{emptyPhone &&
|
|
215
|
-
{phoneFormatError &&
|
|
175
|
+
{emptyPhone && <label>Ingrese su número de teléfono</label>}
|
|
176
|
+
{phoneFormatError && (
|
|
216
177
|
<label>Introduzca un número valido ( Solo numeros )</label>
|
|
217
178
|
)}
|
|
218
179
|
<ScreenHeader text={"País"} headerType={"input-name-header"} />
|
|
219
|
-
<select
|
|
220
|
-
|
|
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
|
-
>
|
|
228
|
-
<option value="value1" selected>
|
|
180
|
+
<select name="select" className="country-options" id="countrySelect">
|
|
181
|
+
<option value="value" selected>
|
|
229
182
|
Selecciona tu país
|
|
230
183
|
</option>
|
|
231
|
-
<option value="
|
|
232
|
-
<option value="
|
|
233
|
-
<option value="
|
|
234
|
-
<option value="
|
|
235
|
-
<option value="
|
|
236
|
-
<option value="
|
|
237
|
-
<option value="
|
|
238
|
-
<option value="
|
|
184
|
+
<option value="Argentina">Argentina</option>
|
|
185
|
+
<option value="Colombia">Colombia</option>
|
|
186
|
+
<option value="Ecuador">Ecuador</option>
|
|
187
|
+
<option value="El Salvador">El Salvador</option>
|
|
188
|
+
<option value="Honduras">Honduras</option>
|
|
189
|
+
<option value="México">México</option>
|
|
190
|
+
<option value="Panamá">Panamá</option>
|
|
191
|
+
<option value="Perú">Perú</option>
|
|
239
192
|
</select>
|
|
240
|
-
{
|
|
193
|
+
{emptyCountry && <label>Seleccione su país</label>}
|
|
241
194
|
</div>,
|
|
242
195
|
<div className="button-end" key="4">
|
|
243
196
|
<Button
|
|
244
197
|
buttonType={"general-default-button"}
|
|
245
198
|
label={"Enviar"}
|
|
246
|
-
onClick={(e) =>
|
|
199
|
+
onClick={(e) => {
|
|
200
|
+
let flag = validate(e);
|
|
201
|
+
validateForm(e, flag);
|
|
202
|
+
}}
|
|
247
203
|
/>
|
|
248
204
|
</div>,
|
|
249
205
|
<div className="progress-bar" key="5">
|
|
@@ -264,13 +220,11 @@ export const RegistrationFirstStep = (props) => {
|
|
|
264
220
|
];
|
|
265
221
|
return (
|
|
266
222
|
<Container>
|
|
267
|
-
<
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
/>
|
|
273
|
-
</div>
|
|
223
|
+
<GradientPanel
|
|
224
|
+
componentsArray={loginRight}
|
|
225
|
+
panelType={"home-login"}
|
|
226
|
+
panelColor={GlobalColors.white}
|
|
227
|
+
/>
|
|
274
228
|
</Container>
|
|
275
229
|
);
|
|
276
230
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Container } from "./styles";
|
|
2
2
|
import { GradientPanel } from "../../atoms/GradientPanel";
|
|
3
|
-
import { useState
|
|
3
|
+
import { useState } 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";
|
|
@@ -8,46 +8,27 @@ import { LoginPasswordStrength } from "../../molecules/LoginPasswordStrength";
|
|
|
8
8
|
import { LogoImage } from "../../atoms/LogoImage";
|
|
9
9
|
|
|
10
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
11
|
const [privacyCheck, setPrivacyCheck] = useState(false);
|
|
18
12
|
const [termsCheck, setTermsCheck] = useState(false);
|
|
19
|
-
|
|
20
13
|
const [emptyPassword, setEmptyPassword] = useState(false);
|
|
21
14
|
const [emptyConfirmPassword, setEmptyConfirmPassword] = useState(false);
|
|
22
15
|
const [matchPasswords, setMatchPasswords] = useState(true);
|
|
23
|
-
|
|
24
16
|
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
17
|
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
18
|
+
const validateForm = (evt, valid) => {
|
|
19
|
+
evt.preventDefault();
|
|
20
|
+
const password = document.querySelector("#newPasswordInput").value;
|
|
21
|
+
if (valid) {
|
|
22
|
+
!termsCheck && (valid = false);
|
|
23
|
+
!privacyCheck && (valid = false);
|
|
24
|
+
nuevoUsuario.password = password;
|
|
25
|
+
sessionStorage.setItem("nuevoRegistro", JSON.stringify(nuevoUsuario));
|
|
26
|
+
valid && props.setPaso(3);
|
|
27
|
+
}
|
|
28
|
+
};
|
|
29
|
+
const validate = (e) => {
|
|
50
30
|
e.preventDefault();
|
|
31
|
+
let valid = true;
|
|
51
32
|
const password = document.querySelector("#newPasswordInput").value;
|
|
52
33
|
password.length < 8 ? setEmptyPassword(true) : setEmptyPassword(false);
|
|
53
34
|
const confirmPassword = document.querySelector(
|
|
@@ -56,48 +37,18 @@ export const RegistrationSecondStep = (props) => {
|
|
|
56
37
|
confirmPassword === ""
|
|
57
38
|
? setEmptyConfirmPassword(true)
|
|
58
39
|
: setEmptyConfirmPassword(false);
|
|
59
|
-
|
|
60
|
-
setMatchPasswords(true)
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
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
|
-
}
|
|
40
|
+
password === confirmPassword
|
|
41
|
+
? setMatchPasswords(true)
|
|
42
|
+
: setMatchPasswords(false);
|
|
43
|
+
if (
|
|
44
|
+
password.length < 8 ||
|
|
45
|
+
confirmPassword === "" ||
|
|
46
|
+
password !== confirmPassword
|
|
47
|
+
) {
|
|
48
|
+
valid = false;
|
|
49
|
+
}
|
|
50
|
+
return valid;
|
|
88
51
|
};
|
|
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);
|
|
99
|
-
};
|
|
100
|
-
|
|
101
52
|
const loginRight = [
|
|
102
53
|
<LogoImage key="1" />,
|
|
103
54
|
<div className="credenciales" key={"2"}>
|
|
@@ -113,12 +64,13 @@ export const RegistrationSecondStep = (props) => {
|
|
|
113
64
|
emptyConfirmPassword={emptyConfirmPassword}
|
|
114
65
|
matchPasswords={matchPasswords}
|
|
115
66
|
textTittle={"Ingresa tus credenciales"}
|
|
116
|
-
|
|
117
|
-
required={required}
|
|
67
|
+
required={"required"}
|
|
118
68
|
/>,
|
|
119
|
-
<label className="label-terms" key={"4"}>
|
|
69
|
+
<label className="label-terms" key={"4"}>
|
|
70
|
+
Términos y condiciones
|
|
71
|
+
</label>,
|
|
120
72
|
<div className="checkbox-terms" key={"5"}>
|
|
121
|
-
<input type="checkbox" />
|
|
73
|
+
<input type="checkbox" onClick={(e) => setTermsCheck(e.target.checked)} />
|
|
122
74
|
<ScreenHeader
|
|
123
75
|
text={
|
|
124
76
|
"Conoce nuestros termnios y condiciones de cada uno de nuestros servicios. Si tienes algunda duda o comentario escríbenos."
|
|
@@ -126,19 +78,32 @@ export const RegistrationSecondStep = (props) => {
|
|
|
126
78
|
headerType={"date-header"}
|
|
127
79
|
/>
|
|
128
80
|
</div>,
|
|
129
|
-
<label className="label-terms" key={"6"}>
|
|
81
|
+
<label className="label-terms" key={"6"}>
|
|
82
|
+
Aviso de privacidad
|
|
83
|
+
</label>,
|
|
130
84
|
<div className="checkbox-terms" key={"7"}>
|
|
131
|
-
<input
|
|
85
|
+
<input
|
|
86
|
+
type="checkbox"
|
|
87
|
+
onClick={(e) => setPrivacyCheck(e.target.checked)}
|
|
88
|
+
/>
|
|
132
89
|
<ScreenHeader
|
|
133
90
|
text={"Todos los datos estan protegidos."}
|
|
134
91
|
headerType={"date-header"}
|
|
135
92
|
/>
|
|
93
|
+
{!termsCheck && !!privacyCheck && (
|
|
94
|
+
<label>
|
|
95
|
+
Seleccione los terminos y condiciones y el Aviso de privacidad
|
|
96
|
+
</label>
|
|
97
|
+
)}
|
|
136
98
|
</div>,
|
|
137
99
|
<div className="button-end" key="8">
|
|
138
100
|
<Button
|
|
139
101
|
buttonType={"general-default-button"}
|
|
140
102
|
label={"Enviar"}
|
|
141
|
-
onClick={(e) =>
|
|
103
|
+
onClick={(e) => {
|
|
104
|
+
let flag = validate(e);
|
|
105
|
+
validateForm(e, flag);
|
|
106
|
+
}}
|
|
142
107
|
/>
|
|
143
108
|
</div>,
|
|
144
109
|
<div className="progress-bar" key={"9"}>
|
|
@@ -160,11 +125,11 @@ export const RegistrationSecondStep = (props) => {
|
|
|
160
125
|
];
|
|
161
126
|
return (
|
|
162
127
|
<Container>
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
128
|
+
<GradientPanel
|
|
129
|
+
panelColor={GlobalColors.white}
|
|
130
|
+
componentsArray={loginRight}
|
|
131
|
+
panelType={"home-login"}
|
|
132
|
+
></GradientPanel>
|
|
168
133
|
</Container>
|
|
169
134
|
);
|
|
170
|
-
};
|
|
135
|
+
};
|
|
@@ -12,8 +12,10 @@ export const RegistrationThirdStep = () => {
|
|
|
12
12
|
const [emptyBussinesName, setEmptyBussinesName] = useState(false);
|
|
13
13
|
const [emptyRFC, setEmptyRFC] = useState(false);
|
|
14
14
|
const [emptyFiscalAddress, setEmptyFiscalAddress] = useState(false);
|
|
15
|
-
|
|
15
|
+
|
|
16
|
+
const validate = (e) => {
|
|
16
17
|
e.preventDefault();
|
|
18
|
+
let valid = true;
|
|
17
19
|
const commercialName = document.querySelector("#commercialNameInput").value;
|
|
18
20
|
const bussinesName = document.querySelector("#bussinesNameInput").value;
|
|
19
21
|
const RFC = document.querySelector("#rfcInput").value;
|
|
@@ -28,7 +30,18 @@ export const RegistrationThirdStep = () => {
|
|
|
28
30
|
FiscalAddress === ""
|
|
29
31
|
? setEmptyFiscalAddress(true)
|
|
30
32
|
: setEmptyFiscalAddress(false);
|
|
33
|
+
if (
|
|
34
|
+
commercialName === "" ||
|
|
35
|
+
bussinesName === "" ||
|
|
36
|
+
RFC === "" ||
|
|
37
|
+
FiscalAddress === ""
|
|
38
|
+
) {
|
|
39
|
+
valid = false;
|
|
40
|
+
}
|
|
41
|
+
valid && sessionStorage.setItem("nuevoRegistro", JSON.stringify(nuevoRegistro));
|
|
42
|
+
valid && props.setPaso(props.paso + 1);
|
|
31
43
|
};
|
|
44
|
+
|
|
32
45
|
const loginRight = [
|
|
33
46
|
<LogoImage key="1" />,
|
|
34
47
|
<div className="credenciales" key={"2"}>
|
|
@@ -9,8 +9,6 @@ export const TagAndInput = ({
|
|
|
9
9
|
inputPlaceHolder,
|
|
10
10
|
inputId,
|
|
11
11
|
required,
|
|
12
|
-
onChange,
|
|
13
|
-
defaultValue,
|
|
14
12
|
}) => {
|
|
15
13
|
return (
|
|
16
14
|
<Container
|
|
@@ -25,8 +23,6 @@ export const TagAndInput = ({
|
|
|
25
23
|
inputValue={value}
|
|
26
24
|
inputPlaceholder={inputPlaceHolder}
|
|
27
25
|
required={required}
|
|
28
|
-
onChange={onChange}
|
|
29
|
-
defaultValue={defaultValue}
|
|
30
26
|
/>
|
|
31
27
|
</Container>
|
|
32
28
|
);
|