contentoh-components-library 21.0.40 → 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.
Files changed (26) hide show
  1. package/dist/components/atoms/GeneralInput/index.js +2 -6
  2. package/dist/components/atoms/Loading/styles.js +1 -1
  3. package/dist/components/molecules/LoginPasswordStrength/index.js +2 -8
  4. package/dist/components/molecules/RegistrationFirstStep/index.js +28 -21
  5. package/dist/components/molecules/RegistrationFirstStep/styles.js +1 -1
  6. package/dist/components/molecules/RegistrationSecondStep/index.js +42 -110
  7. package/dist/components/molecules/RegistrationThirdStep/index.js +19 -33
  8. package/dist/components/molecules/TagAndInput/index.js +2 -6
  9. package/dist/components/molecules/VerificationCodeResetPasswordLogin/index.js +18 -17
  10. package/dist/components/molecules/VerificationCodeResetPasswordLogin/utils.js +2 -2
  11. package/dist/components/organisms/ChangePassword/index.js +13 -3
  12. package/dist/components/organisms/ChangePassword/styles.js +1 -1
  13. package/package.json +2 -2
  14. package/src/components/atoms/GeneralInput/index.js +0 -4
  15. package/src/components/atoms/Loading/styles.js +2 -2
  16. package/src/components/molecules/EmailResetPasswordLogin/index.js +0 -1
  17. package/src/components/molecules/LoginPasswordStrength/index.js +0 -5
  18. package/src/components/molecules/RegistrationFirstStep/index.js +38 -32
  19. package/src/components/molecules/RegistrationFirstStep/styles.js +3 -3
  20. package/src/components/molecules/RegistrationSecondStep/index.js +51 -86
  21. package/src/components/molecules/RegistrationThirdStep/index.js +14 -1
  22. package/src/components/molecules/TagAndInput/index.js +0 -4
  23. package/src/components/molecules/VerificationCodeResetPasswordLogin/index.js +17 -15
  24. package/src/components/molecules/VerificationCodeResetPasswordLogin/utils.js +2 -4
  25. package/src/components/organisms/ChangePassword/index.js +16 -3
  26. package/src/components/organisms/ChangePassword/styles.js +2 -2
@@ -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 width: 50%;\n height: 100vh;\n .button-center {\n text-align: center;\n position: absolute;\n bottom: 5%;\n left: calc(75% - 80px);\n .general-default-button {\n width: 160px;\n }\n }\n"])));
16
+ var Container = _styledComponents.default.div(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n display: flex;\n width: 50%;\n height: 100vh;\n .button-center {\n //text-align: center;\n position: absolute;\n bottom: 5%;\n left: 14%;\n .general-default-button {\n width: 160px;\n }\n }\n"])));
17
17
 
18
18
  exports.Container = Container;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "contentoh-components-library",
3
- "version": "21.0.40",
3
+ "version": "21.0.41",
4
4
  "dependencies": {
5
5
  "@aws-amplify/auth": "^4.5.3",
6
6
  "@aws-amplify/datastore": "^3.11.0",
@@ -77,7 +77,7 @@
77
77
  "auto": "^10.36.5",
78
78
  "babel-loader": "^8.2.3",
79
79
  "chromatic": "^6.3.3",
80
- "contentoh-components-library": "^21.0.26",
80
+ "contentoh-components-library": "^21.0.40",
81
81
  "cross-env": "^7.0.3",
82
82
  "storybook-css-modules-preset": "^1.1.1"
83
83
  },
@@ -14,9 +14,7 @@ export const GeneralInput = ({
14
14
  inputsArray,
15
15
  maxLength,
16
16
  inputSize,
17
- onChange,
18
17
  required,
19
- defaultValue,
20
18
  }) => {
21
19
  const [textValue, setTextValue] = useState({ value: inputValue ?? "" });
22
20
 
@@ -45,9 +43,7 @@ export const GeneralInput = ({
45
43
  value={textValue.value}
46
44
  onInput={(e) => onHandleChange(e)}
47
45
  maxLength={maxLength && maxLength}
48
- onChange={onChange}
49
46
  required={required}
50
- defaultValue={defaultValue}
51
47
  />
52
48
  ) : (
53
49
  <textarea
@@ -7,7 +7,7 @@ export const Container = styled.div`
7
7
  width: 50%;
8
8
  position: relative;
9
9
  img {
10
- width: 80%;
10
+ width: 70%;
11
11
  position: absolute;
12
12
  bottom: 55%;
13
13
  left: 10%;
@@ -20,7 +20,7 @@ export const Container = styled.div`
20
20
  width: 50%;
21
21
  position: absolute;
22
22
  bottom: 45%;
23
- left:25%;
23
+ left:15%;
24
24
  span {
25
25
  display: inline-block;
26
26
  border-radius: 100%;
@@ -26,7 +26,6 @@ export const EmailResetPasswordLogin = (props) => {
26
26
  : setInvalidEmail(false);
27
27
  emptyEmail && (valid = false);
28
28
  invalidEmail && (valid = false);
29
-
30
29
  if (valid) {
31
30
  try {
32
31
  await props.Auth.forgotPassword(email);
@@ -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>
@@ -34,8 +34,7 @@ export const RegistrationFirstStep = (props) => {
34
34
  sessionStorage.getItem("resetPasswordProcess") &&
35
35
  sessionStorage.getItem("resetPasswordProcess");
36
36
  }, []);
37
-
38
- const validateForm = (evt) => {
37
+ const validate = (evt) => {
39
38
  let valid = true;
40
39
  evt.preventDefault();
41
40
  const name = document.querySelector("#nameInput").value;
@@ -44,7 +43,6 @@ export const RegistrationFirstStep = (props) => {
44
43
  const job = document.querySelector("#jobInput").value;
45
44
  const phone = document.querySelector("#phoneInput").value;
46
45
  const country = document.querySelector("#countrySelect").value;
47
- const countryCode = document.querySelector("#countryCodeSelect").value;
48
46
  name === "" ? setEmptyName(true) : setEmptyName(false);
49
47
  lastName === "" ? setEmptyLastName(true) : setEmptyLastName(false);
50
48
  email === "" ? setEmptyEmail(true) : setEmptyEmail(false);
@@ -55,28 +53,37 @@ export const RegistrationFirstStep = (props) => {
55
53
  )
56
54
  ? setInvalidEmail(true)
57
55
  : setInvalidEmail(false);
58
- country === "" || country === "+ tu país"
59
- ? setEmptyCountry(true)
60
- : setEmptyCountry(false);
56
+ let invalidPhone = true;
57
+ country === "value" ? setEmptyCountry(true) : setEmptyCountry(false);
61
58
  Array.from(phone).forEach((digit, i) => {
62
59
  phone.charCodeAt(i) < 48
63
60
  ? setPhoneFormatError(true)
64
- : setPhoneFormatError(false);
61
+ : (invalidPhone = false);
65
62
  phone.charCodeAt(i) > 57
66
63
  ? setPhoneFormatError(true)
67
- : setPhoneFormatError(false);
64
+ : (invalidPhone = false);
68
65
  });
69
- let nuevoUsuario = JSON.parse(sessionStorage.getItem("nuevoRegistro"));
70
66
  if (
71
- !emptyName ||
72
- !emptyLastName ||
73
- !emptyEmail ||
74
- !emptyJob ||
75
- !emptyPhone ||
76
- !emptyCountry ||
77
- !invalidEmail ||
78
- !phoneFormatError
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
79
77
  ) {
78
+ valid = false;
79
+ } else valid = true;
80
+
81
+ return valid;
82
+ };
83
+ const validateForm = (evt, valid) => {
84
+ evt.preventDefault();
85
+ let nuevoUsuario = JSON.parse(sessionStorage.getItem("nuevoRegistro"));
86
+ if (valid) {
80
87
  sessionStorage.setItem("countryCode", JSON.stringify(countryCode));
81
88
  nuevoUsuario.name = name;
82
89
  nuevoUsuario.lastName = lastName;
@@ -89,10 +96,6 @@ export const RegistrationFirstStep = (props) => {
89
96
  sessionStorage.setItem("nuevoRegistro", JSON.stringify(nuevoUsuario));
90
97
  !regError && valid && props.setPaso((paso) => props.paso + 1);
91
98
  regError && valid && props.setPaso(4);
92
- console.log("rediring");
93
- } else {
94
- valid = false;
95
- console.log("code");
96
99
  }
97
100
  };
98
101
 
@@ -175,25 +178,28 @@ export const RegistrationFirstStep = (props) => {
175
178
  )}
176
179
  <ScreenHeader text={"País"} headerType={"input-name-header"} />
177
180
  <select name="select" className="country-options" id="countrySelect">
178
- <option value="value1" selected>
181
+ <option value="value" selected>
179
182
  Selecciona tu país
180
183
  </option>
181
- <option value="value2">Argentina</option>
182
- <option value="value3">Colombia</option>
183
- <option value="value2">Ecuador</option>
184
- <option value="value3">El Salvador</option>
185
- <option value="value2">Honduras</option>
186
- <option value="value3">México</option>
187
- <option value="value2">Panamá</option>
188
- <option value="value3">Perú</option>
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>
189
192
  </select>
190
- {emptyEmail && <label>Seleccione su país</label>}
193
+ {emptyCountry && <label>Seleccione su país</label>}
191
194
  </div>,
192
195
  <div className="button-end" key="4">
193
196
  <Button
194
197
  buttonType={"general-default-button"}
195
198
  label={"Enviar"}
196
- onClick={(e) => validateForm(e)}
199
+ onClick={(e) => {
200
+ let flag = validate(e);
201
+ validateForm(e, flag);
202
+ }}
197
203
  />
198
204
  </div>,
199
205
  <div className="progress-bar" key="5">
@@ -75,10 +75,10 @@ export const Container = styled.div`
75
75
  .new-login {
76
76
  & + * {
77
77
  margin-top: 20px;
78
- p {
79
- cursor: pointer;
80
- }
81
78
  }
82
79
  }
83
80
  }
81
+ .pre-registro {
82
+ cursor: pointer;
83
+ }
84
84
  `;
@@ -1,6 +1,6 @@
1
1
  import { Container } from "./styles";
2
2
  import { GradientPanel } from "../../atoms/GradientPanel";
3
- import { useState, useEffect } from "react";
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
- // 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) => {
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
- if (password === confirmPassword) {
60
- setMatchPasswords(true);
61
- } else {
62
- setMatchPasswords(false);
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
- }
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
- onChange={(e) => updateInfo(e, e.target.value)}
117
67
  required={"required"}
118
68
  />,
119
- <label className="label-terms" key={"4"}>Términos y condiciones</label>,
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"}>Aviso de privacidad</label>,
81
+ <label className="label-terms" key={"6"}>
82
+ Aviso de privacidad
83
+ </label>,
130
84
  <div className="checkbox-terms" key={"7"}>
131
- <input type="checkbox" />
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) => validate(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
- <GradientPanel
164
- panelColor={GlobalColors.white}
165
- componentsArray={loginRight}
166
- panelType={"home-login"}
167
- ></GradientPanel>
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
- const validate = async (e) => {
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
  );
@@ -12,18 +12,20 @@ export const VerificationCodeResetPasswordLogin = (props) => {
12
12
  const [resend, setResend] = useState(false);
13
13
  const [awsError, setAwsError] = useState("");
14
14
  const [emptyVerificationCode, setEmptyVerificationCode] = useState(false);
15
- const [inputCodeVerificationAll, setInputCodeVerificationAll] = useState();
15
+ const [inputCodeVerificationAll, setInputCodeVerificationAll] = useState(
16
+ document.querySelectorAll("[id^='verificationCodeInput']")
17
+ );
16
18
  const inputPositions = [1, 2, 3, 4, 5, 6];
17
19
 
18
20
  useEffect(() => {
19
21
  props.confirmationError !== "" && setEmptyVerificationCode(false);
20
22
  }, [props.confirmationError]);
21
23
 
22
- const checkCode = (e) => {
24
+ const checkCode = (e, flag) => {
23
25
  let valid = true;
24
26
  e.preventDefault();
25
27
  let code = "";
26
- if (awsError === "" && !emptyVerificationCode) {
28
+ if (awsError === "" && !flag) {
27
29
  inputPositions.map(
28
30
  (position) =>
29
31
  (code =
@@ -35,19 +37,18 @@ export const VerificationCodeResetPasswordLogin = (props) => {
35
37
  (valid = false);
36
38
  }
37
39
  sessionStorage.setItem("confirmationCode", JSON.stringify(code));
38
- setEmptyVerificationCode(false);
39
40
  valid &&
40
- !sessionStorage.getItem("resetPasswordProcess") &&
41
- props.setPaso(6);
41
+ !sessionStorage.getItem("resetPasswordProcess") &&
42
+ props.setPaso(6);
42
43
  valid &&
43
- sessionStorage.getItem("resetPasswordProcess") &&
44
- props.setPaso(8);
44
+ sessionStorage.getItem("resetPasswordProcess") &&
45
+ props.setPaso(8);
45
46
  }
46
47
  };
47
48
 
48
49
  const validateResend = async (e) => {
49
50
  e.preventDefault();
50
- //const email = JSON.parse(sessionStorage.getItem("email"));
51
+ const email = JSON.parse(sessionStorage.getItem("email"));
51
52
  try {
52
53
  await props.Auth.forgotPassword(email);
53
54
  sessionStorage.setItem("email", JSON.stringify(email));
@@ -86,9 +87,9 @@ export const VerificationCodeResetPasswordLogin = (props) => {
86
87
  )}
87
88
  {!sessionStorage.getItem("email") && (
88
89
  <ScreenHeader
89
- text={`Ingrese código de verificación enviado a: ${
90
- JSON.parse(sessionStorage.getItem("nuevoRegistro")).email
91
- }`}
90
+ text={`Ingrese código de verificación enviado a: ${
91
+ JSON.parse(sessionStorage.getItem("nuevoRegistro")).email
92
+ }`}
92
93
  headerType={"input-name-header"}
93
94
  />
94
95
  )}
@@ -147,13 +148,14 @@ export const VerificationCodeResetPasswordLogin = (props) => {
147
148
  buttonType={"general-default-button"}
148
149
  label={"Enviar"}
149
150
  onClick={(e) => {
150
- validate(inputCodeVerificationAll, setEmptyVerificationCode);
151
- checkCode(e);
151
+ let flag = validate(inputCodeVerificationAll);
152
+ checkCode(e, flag);
153
+ setEmptyVerificationCode(flag);
152
154
  }}
153
155
  />
154
156
  </div>,
155
157
  <div className="reset-password" key="6">
156
- <p onClick={() => props.setPaso(10)}>Regresar...</p>
158
+ <p onClick={() => props.setPaso(10)}>Regresar...</p>
157
159
  </div>,
158
160
  ];
159
161
  return (
@@ -45,12 +45,10 @@ const nextInputFocus = (inputsArray, index) => {
45
45
  * @param {function} setEmptyVerificationCode function to update flag which handles if there's an empty char
46
46
  * updates emptyVerificationFlag from father component
47
47
  */
48
- export const validate = (inputsArray, setEmptyVerificationCode) => {
48
+ export const validate = (inputsArray) => {
49
49
  let contInputEmpty = 0;
50
50
  inputsArray.forEach((element) => {
51
51
  element.value === "" ? 0 : contInputEmpty++;
52
52
  });
53
- contInputEmpty === inputsArray.length
54
- ? setEmptyVerificationCode(false)
55
- : setEmptyVerificationCode(true);
53
+ return contInputEmpty !== inputsArray.length
56
54
  };
@@ -7,15 +7,17 @@ import { ScreenHeader } from "../../atoms/ScreenHeader";
7
7
  import { GlobalColors, FontFamily } from "../../../global-files/variables";
8
8
  import { GradientPanel } from "../../atoms/GradientPanel";
9
9
 
10
- export const ChangePassword = () => {
10
+ export const ChangePassword = (props) => {
11
+
11
12
  const [emptyPassword, setEmptyPassword] = useState(false);
12
13
  const [emptyConfirmPassword, setEmptyConfirmPassword] = useState(false);
13
14
  const [matchPasswords, setMatchPasswords] = useState(true);
15
+
14
16
  const validate = async (e) => {
15
17
  e.preventDefault();
16
- const password = document.querySelector("#newPasswordInput").value;
18
+ let password = document.querySelector("#newPasswordInput").value;
17
19
  password.length < 8 ? setEmptyPassword(true) : setEmptyPassword(false);
18
- const confirmPassword = document.querySelector(
20
+ let confirmPassword = document.querySelector(
19
21
  "#confirmPasswordInput"
20
22
  ).value;
21
23
  confirmPassword === ""
@@ -26,7 +28,18 @@ export const ChangePassword = () => {
26
28
  } else {
27
29
  setMatchPasswords(false);
28
30
  }
31
+ let valid = true;
32
+ emptyPassword && (valid = false);
33
+ emptyConfirmPassword && (valid = false);
34
+ !matchPasswords && (valid = false);
35
+ if (valid) {
36
+ sessionStorage.setItem("newPassword", JSON.stringify(password));
37
+ !sessionStorage.getItem("resetPasswordProcess")
38
+ ? props.setPaso(9)
39
+ : props.setPaso(11);
40
+ }
29
41
  };
42
+
30
43
  const loginRight = [
31
44
  <LogoImage key="1" />,
32
45
  <div className="credenciales" key={"2"}>
@@ -5,10 +5,10 @@ export const Container = styled.div`
5
5
  width: 50%;
6
6
  height: 100vh;
7
7
  .button-center {
8
- text-align: center;
8
+ //text-align: center;
9
9
  position: absolute;
10
10
  bottom: 5%;
11
- left: calc(75% - 80px);
11
+ left: 14%;
12
12
  .general-default-button {
13
13
  width: 160px;
14
14
  }