contentoh-components-library 21.0.39 → 21.0.42
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 +78 -135
- package/dist/components/molecules/RegistrationFirstStep/styles.js +1 -1
- package/dist/components/molecules/RegistrationSecondStep/index.js +42 -110
- 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 +91 -136
- package/src/components/molecules/RegistrationFirstStep/styles.js +4 -1
- package/src/components/molecules/RegistrationSecondStep/index.js +51 -86
- 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 +1 -2
|
@@ -8,11 +8,59 @@ import { GeneralInput } from "../../atoms/GeneralInput";
|
|
|
8
8
|
import { Button } from "../../atoms/GeneralButton";
|
|
9
9
|
import { validateInput, validate } from "./utils";
|
|
10
10
|
|
|
11
|
-
export const VerificationCodeResetPasswordLogin = () => {
|
|
11
|
+
export const VerificationCodeResetPasswordLogin = (props) => {
|
|
12
|
+
const [resend, setResend] = useState(false);
|
|
13
|
+
const [awsError, setAwsError] = useState("");
|
|
12
14
|
const [emptyVerificationCode, setEmptyVerificationCode] = useState(false);
|
|
13
|
-
const [inputCodeVerificationAll, setInputCodeVerificationAll] = useState(
|
|
15
|
+
const [inputCodeVerificationAll, setInputCodeVerificationAll] = useState(
|
|
16
|
+
document.querySelectorAll("[id^='verificationCodeInput']")
|
|
17
|
+
);
|
|
14
18
|
const inputPositions = [1, 2, 3, 4, 5, 6];
|
|
15
19
|
|
|
20
|
+
useEffect(() => {
|
|
21
|
+
props.confirmationError !== "" && setEmptyVerificationCode(false);
|
|
22
|
+
}, [props.confirmationError]);
|
|
23
|
+
|
|
24
|
+
const checkCode = (e, flag) => {
|
|
25
|
+
let valid = true;
|
|
26
|
+
e.preventDefault();
|
|
27
|
+
let code = "";
|
|
28
|
+
if (awsError === "" && !flag) {
|
|
29
|
+
inputPositions.map(
|
|
30
|
+
(position) =>
|
|
31
|
+
(code =
|
|
32
|
+
code +
|
|
33
|
+
document.querySelector(`#verificationCodeInput${position}`).value)
|
|
34
|
+
);
|
|
35
|
+
if (sessionStorage.getItem("resetError")) {
|
|
36
|
+
JSON.parse(sessionStorage.getItem("confirmationCode")) === code &&
|
|
37
|
+
(valid = false);
|
|
38
|
+
}
|
|
39
|
+
sessionStorage.setItem("confirmationCode", JSON.stringify(code));
|
|
40
|
+
valid &&
|
|
41
|
+
!sessionStorage.getItem("resetPasswordProcess") &&
|
|
42
|
+
props.setPaso(6);
|
|
43
|
+
valid &&
|
|
44
|
+
sessionStorage.getItem("resetPasswordProcess") &&
|
|
45
|
+
props.setPaso(8);
|
|
46
|
+
}
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
const validateResend = async (e) => {
|
|
50
|
+
e.preventDefault();
|
|
51
|
+
const email = JSON.parse(sessionStorage.getItem("email"));
|
|
52
|
+
try {
|
|
53
|
+
await props.Auth.forgotPassword(email);
|
|
54
|
+
sessionStorage.setItem("email", JSON.stringify(email));
|
|
55
|
+
sessionStorage.setItem("resetPasswordProcess", JSON.stringify("true"));
|
|
56
|
+
props.setPaso(5);
|
|
57
|
+
setResend(true);
|
|
58
|
+
} catch (err) {
|
|
59
|
+
setAwsError(err.code);
|
|
60
|
+
console.log(err.message);
|
|
61
|
+
}
|
|
62
|
+
};
|
|
63
|
+
|
|
16
64
|
useEffect(() => {
|
|
17
65
|
setInputCodeVerificationAll(
|
|
18
66
|
document.querySelectorAll("[id^='verificationCodeInput']")
|
|
@@ -29,10 +77,22 @@ export const VerificationCodeResetPasswordLogin = () => {
|
|
|
29
77
|
/>
|
|
30
78
|
</div>,
|
|
31
79
|
<div className="user" key="3">
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
80
|
+
{sessionStorage.getItem("email") && (
|
|
81
|
+
<ScreenHeader
|
|
82
|
+
text={`Ingrese el código de verificación enviado a: ${JSON.parse(
|
|
83
|
+
sessionStorage.getItem("email")
|
|
84
|
+
)}`}
|
|
85
|
+
headerType={"input-name-header"}
|
|
86
|
+
/>
|
|
87
|
+
)}
|
|
88
|
+
{!sessionStorage.getItem("email") && (
|
|
89
|
+
<ScreenHeader
|
|
90
|
+
text={`Ingrese código de verificación enviado a: ${
|
|
91
|
+
JSON.parse(sessionStorage.getItem("nuevoRegistro")).email
|
|
92
|
+
}`}
|
|
93
|
+
headerType={"input-name-header"}
|
|
94
|
+
/>
|
|
95
|
+
)}
|
|
36
96
|
<div className="verification-code">
|
|
37
97
|
{inputPositions.map((position) => (
|
|
38
98
|
<GeneralInput
|
|
@@ -49,21 +109,53 @@ export const VerificationCodeResetPasswordLogin = () => {
|
|
|
49
109
|
{emptyVerificationCode && (
|
|
50
110
|
<label>Ingrese su código de verificación</label>
|
|
51
111
|
)}
|
|
112
|
+
{sessionStorage.getItem("resetError") && (
|
|
113
|
+
<label>Código de verifiación incorrecto</label>
|
|
114
|
+
)}
|
|
115
|
+
{props.confirmationError === "LimitExceededException" &&
|
|
116
|
+
!emptyVerificationCode && (
|
|
117
|
+
<label>Haz realizado demasiados intentos, intentalo más tarde</label>
|
|
118
|
+
)}
|
|
119
|
+
{props.confirmationError === "CodeMismatchException" &&
|
|
120
|
+
!emptyVerificationCode && (
|
|
121
|
+
<label>Código de verificación incorrecto</label>
|
|
122
|
+
)}
|
|
123
|
+
{props.confirmationError === "ExpiredCodeException" &&
|
|
124
|
+
!emptyVerificationCode && (
|
|
125
|
+
<label>El código ingresado está expirado</label>
|
|
126
|
+
)}
|
|
127
|
+
{props.confirmationError === "InternalErrorException" &&
|
|
128
|
+
!emptyVerificationCode && (
|
|
129
|
+
<label>Algo salió mal, porfavor vuelva a intentarlo</label>
|
|
130
|
+
)}
|
|
131
|
+
{awsError === "LimitExceededException" && (
|
|
132
|
+
<label>Haz realizado demasiados intentos, intentalo más tarde</label>
|
|
133
|
+
)}
|
|
134
|
+
{awsError === "InternalErrorException" && (
|
|
135
|
+
<label>Algo salió mal, porfavor vuelva a intentarlo</label>
|
|
136
|
+
)}
|
|
137
|
+
{resend && awsError === "" && (
|
|
138
|
+
<label className="resendTrue">
|
|
139
|
+
Se reenvió el código de verificación correctamente
|
|
140
|
+
</label>
|
|
141
|
+
)}
|
|
52
142
|
</div>,
|
|
53
143
|
<div className="resend-code" key="4">
|
|
54
|
-
<p>Reenviar código de verificación</p>
|
|
144
|
+
<p onClick={(e) => validateResend(e)}>Reenviar código de verificación</p>
|
|
55
145
|
</div>,
|
|
56
146
|
<div className="button-center" key="5">
|
|
57
147
|
<Button
|
|
58
148
|
buttonType={"general-default-button"}
|
|
59
149
|
label={"Enviar"}
|
|
60
|
-
onClick={(e) =>
|
|
61
|
-
validate(inputCodeVerificationAll
|
|
62
|
-
|
|
150
|
+
onClick={(e) => {
|
|
151
|
+
let flag = validate(inputCodeVerificationAll);
|
|
152
|
+
checkCode(e, flag);
|
|
153
|
+
setEmptyVerificationCode(flag);
|
|
154
|
+
}}
|
|
63
155
|
/>
|
|
64
156
|
</div>,
|
|
65
157
|
<div className="reset-password" key="6">
|
|
66
|
-
|
|
158
|
+
<p onClick={() => props.setPaso(10)}>Regresar...</p>
|
|
67
159
|
</div>,
|
|
68
160
|
];
|
|
69
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
|
|
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
|
|
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
|
-
|
|
18
|
+
let password = document.querySelector("#newPasswordInput").value;
|
|
17
19
|
password.length < 8 ? setEmptyPassword(true) : setEmptyPassword(false);
|
|
18
|
-
|
|
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"}>
|