contentoh-components-library 21.0.73 → 21.0.76
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/.env.development +4 -2
- package/.env.production +4 -2
- package/CHANGELOG.md +39 -0
- package/dist/assets/images/editField/showPassword.png +0 -0
- package/dist/assets/images/sliderToolTip/infoIcon.svg +4 -0
- package/dist/assets/images/sliderToolTip/slide1.svg +5 -0
- package/dist/assets/images/sliderToolTip/slide2.svg +9 -0
- package/dist/assets/images/sliderToolTip/slide3.svg +9 -0
- package/dist/assets/images/sliderToolTip/slide4.svg +9 -0
- package/dist/assets/images/sliderToolTip/slide5.svg +40 -0
- package/dist/assets/images/verticalSideMenuMainPage/closeMenu.svg +4 -0
- package/dist/assets/images/verticalSideMenuMainPage/iconFAQS.svg +12 -0
- package/dist/assets/images/verticalSideMenuMainPage/iconGroup.svg +3 -0
- package/dist/assets/images/verticalSideMenuMainPage/iconLogo.svg +12 -0
- package/dist/assets/images/verticalSideMenuMainPage/iconLogoContentoh.svg +15 -0
- package/dist/assets/images/verticalSideMenuMainPage/iconProduct.svg +3 -0
- package/dist/assets/images/verticalSideMenuMainPage/iconSpeedometer.svg +12 -0
- package/dist/assets/images/verticalSideMenuMainPage/iconTask.svg +10 -0
- package/dist/assets/images/verticalSideMenuMainPage/openMenu.svg +4 -0
- package/dist/components/atoms/GeneralInput/index.js +4 -3
- package/dist/components/atoms/GradientPanel/styles.js +1 -1
- package/dist/components/atoms/Loading/Loading.stories.js +28 -0
- package/dist/components/atoms/Loading/index.js +1 -0
- package/dist/components/atoms/LogoImage/index.js +1 -0
- package/dist/components/atoms/SliderToolTip/SliderToolTip.stories.js +47 -0
- package/dist/components/atoms/SliderToolTip/index.js +200 -0
- package/dist/components/atoms/SliderToolTip/styles.js +24 -0
- package/dist/components/atoms/VerticalSideMenuMainPage/VerticalSideMenuMainPage.stories.js +28 -0
- package/dist/components/atoms/VerticalSideMenuMainPage/index.js +99 -0
- package/dist/components/atoms/VerticalSideMenuMainPage/styles.js +24 -0
- package/dist/components/molecules/CarouselImagesLogin/index.js +40 -42
- package/dist/components/molecules/EmailResetPasswordLogin/EmailResetPasswordLogin.stories.js +28 -0
- package/dist/components/molecules/EmailResetPasswordLogin/index.js +153 -0
- package/dist/components/molecules/EmailResetPasswordLogin/styles.js +20 -0
- package/dist/components/molecules/LoginPasswordStrength/index.js +9 -9
- package/dist/components/molecules/LoginPasswordStrength/styles.js +1 -1
- package/dist/components/molecules/LogoLoading/Loading.stories.js +28 -0
- package/dist/components/molecules/LogoLoading/index.js +22 -0
- package/dist/components/molecules/LogoLoading/styles.js +18 -0
- package/dist/components/molecules/RegistrationFirstStep/RegistrationFirstStep.stories.js +28 -0
- package/dist/components/molecules/RegistrationFirstStep/index.js +308 -0
- package/dist/components/molecules/RegistrationFirstStep/styles.js +20 -0
- package/dist/components/molecules/RegistrationSecondStep/RegistrationSecondStep.stories.js +28 -0
- package/dist/components/molecules/RegistrationSecondStep/index.js +173 -0
- package/dist/components/molecules/RegistrationSecondStep/styles.js +20 -0
- package/dist/components/molecules/RegistrationThirdStep/RegistrationThirdStep.stories.js +28 -0
- package/dist/components/molecules/RegistrationThirdStep/index.js +155 -0
- package/dist/components/molecules/RegistrationThirdStep/styles.js +20 -0
- package/dist/components/molecules/SignInLogin/SignInLogin.stories.js +28 -0
- package/dist/components/molecules/SignInLogin/index.js +315 -0
- package/dist/components/molecules/SignInLogin/styles.js +20 -0
- package/dist/components/molecules/TagAndInput/index.js +4 -2
- package/dist/components/molecules/VerificationCodeResetPasswordLogin/VerificationCodeResetPasswordLogin.stories.js +28 -0
- package/dist/components/molecules/VerificationCodeResetPasswordLogin/index.js +211 -0
- package/dist/components/molecules/VerificationCodeResetPasswordLogin/styles.js +20 -0
- package/dist/components/molecules/VerificationCodeResetPasswordLogin/utils.js +69 -0
- package/dist/components/organisms/ChangePassword/ChangePassword.stories.js +28 -0
- package/dist/components/organisms/ChangePassword/index.js +124 -0
- package/dist/components/organisms/ChangePassword/styles.js +18 -0
- package/dist/index.js +303 -30
- package/package.json +12 -4
- package/src/assets/images/editField/showPassword.png +0 -0
- package/src/assets/images/sliderToolTip/infoIcon.svg +4 -0
- package/src/assets/images/sliderToolTip/slide1.svg +5 -0
- package/src/assets/images/sliderToolTip/slide2.svg +9 -0
- package/src/assets/images/sliderToolTip/slide3.svg +9 -0
- package/src/assets/images/sliderToolTip/slide4.svg +9 -0
- package/src/assets/images/sliderToolTip/slide5.svg +40 -0
- package/src/assets/images/verticalSideMenuMainPage/closeMenu.svg +4 -0
- package/src/assets/images/verticalSideMenuMainPage/iconFAQS.svg +12 -0
- package/src/assets/images/verticalSideMenuMainPage/iconGroup.svg +3 -0
- package/src/assets/images/verticalSideMenuMainPage/iconLogo.svg +12 -0
- package/src/assets/images/verticalSideMenuMainPage/iconLogoContentoh.svg +15 -0
- package/src/assets/images/verticalSideMenuMainPage/iconProduct.svg +3 -0
- package/src/assets/images/verticalSideMenuMainPage/iconSpeedometer.svg +12 -0
- package/src/assets/images/verticalSideMenuMainPage/iconTask.svg +10 -0
- package/src/assets/images/verticalSideMenuMainPage/openMenu.svg +4 -0
- package/src/components/atoms/GeneralInput/index.js +3 -2
- package/src/components/atoms/GradientPanel/styles.js +1 -0
- package/src/components/atoms/Loading/Loading.stories.js +10 -0
- package/src/components/atoms/Loading/index.js +3 -2
- package/src/components/atoms/LogoImage/index.js +1 -1
- package/src/components/atoms/SliderToolTip/SliderToolTip.stories.js +23 -0
- package/src/components/atoms/SliderToolTip/index.js +182 -0
- package/src/components/atoms/SliderToolTip/styles.js +168 -0
- package/src/components/atoms/VerticalSideMenuMainPage/VerticalSideMenuMainPage.stories.js +12 -0
- package/src/components/atoms/VerticalSideMenuMainPage/index.js +55 -0
- package/src/components/atoms/VerticalSideMenuMainPage/styles.js +45 -0
- package/src/components/molecules/CarouselImagesLogin/index.js +34 -37
- package/src/components/molecules/EmailResetPasswordLogin/EmailResetPasswordLogin.stories.js +11 -0
- package/src/components/molecules/EmailResetPasswordLogin/index.js +85 -0
- package/src/components/molecules/EmailResetPasswordLogin/styles.js +23 -0
- package/src/components/molecules/LoginPasswordStrength/index.js +11 -6
- package/src/components/molecules/LoginPasswordStrength/styles.js +5 -1
- package/src/components/molecules/LogoLoading/Loading.stories.js +10 -0
- package/src/components/molecules/LogoLoading/index.js +12 -0
- package/src/components/molecules/LogoLoading/styles.js +16 -0
- package/src/components/molecules/RegistrationFirstStep/RegistrationFirstStep.stories.js +11 -0
- package/src/components/molecules/RegistrationFirstStep/index.js +227 -0
- package/src/components/molecules/RegistrationFirstStep/styles.js +87 -0
- package/src/components/molecules/RegistrationSecondStep/RegistrationSecondStep.stories.js +11 -0
- package/src/components/molecules/RegistrationSecondStep/index.js +136 -0
- package/src/components/molecules/RegistrationSecondStep/styles.js +64 -0
- package/src/components/molecules/RegistrationThirdStep/RegistrationThirdStep.stories.js +11 -0
- package/src/components/molecules/RegistrationThirdStep/index.js +130 -0
- package/src/components/molecules/RegistrationThirdStep/styles.js +44 -0
- package/src/components/molecules/SignInLogin/SignInLogin.stories.js +11 -0
- package/src/components/molecules/SignInLogin/index.js +226 -0
- package/src/components/molecules/SignInLogin/styles.js +120 -0
- package/src/components/molecules/TagAndInput/index.js +2 -0
- package/src/components/molecules/VerificationCodeResetPasswordLogin/VerificationCodeResetPasswordLogin.stories.js +11 -0
- package/src/components/molecules/VerificationCodeResetPasswordLogin/index.js +171 -0
- package/src/components/molecules/VerificationCodeResetPasswordLogin/styles.js +54 -0
- package/src/components/molecules/VerificationCodeResetPasswordLogin/utils.js +54 -0
- package/src/components/organisms/ChangePassword/ChangePassword.stories.js +11 -0
- package/src/components/organisms/ChangePassword/index.js +77 -0
- package/src/components/organisms/ChangePassword/styles.js +13 -0
- package/src/index.js +22 -1
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import styled from "styled-components";
|
|
2
|
+
import { FontFamily, GlobalColors } from "../../../global-files/variables";
|
|
3
|
+
|
|
4
|
+
export const Container = styled.div`
|
|
5
|
+
display: flex;
|
|
6
|
+
width: 50%;
|
|
7
|
+
height: 100%;
|
|
8
|
+
.user {
|
|
9
|
+
.input-name-header {
|
|
10
|
+
margin-top: 10px;
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
.button-end {
|
|
14
|
+
text-align: end;
|
|
15
|
+
.general-default-button {
|
|
16
|
+
width: 160px;
|
|
17
|
+
}
|
|
18
|
+
& + * {
|
|
19
|
+
margin-top: 10px;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
.progress-bar {
|
|
23
|
+
width: 100%;
|
|
24
|
+
height: 8px;
|
|
25
|
+
display: flex;
|
|
26
|
+
justify-content: space-between;
|
|
27
|
+
.progress-bar-step-check {
|
|
28
|
+
width: 66.66%;
|
|
29
|
+
background-color: ${GlobalColors.exported};
|
|
30
|
+
}
|
|
31
|
+
.progress-bar-registration {
|
|
32
|
+
background-color: rgb(196, 196, 196);
|
|
33
|
+
width: 33.33%;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
.date-header {
|
|
37
|
+
margin-left: 66.66%;
|
|
38
|
+
.new-login {
|
|
39
|
+
& + * {
|
|
40
|
+
margin-top: 20px;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
`;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { SignInLogin } from "./index";
|
|
2
|
+
|
|
3
|
+
export default {
|
|
4
|
+
title: "Components/molecules/SignInLogin",
|
|
5
|
+
component: SignInLogin,
|
|
6
|
+
};
|
|
7
|
+
|
|
8
|
+
const Template = (args) => <SignInLogin {...args} />;
|
|
9
|
+
|
|
10
|
+
export const SignInLoginDefault = Template.bind({});
|
|
11
|
+
SignInLoginDefault.args = {};
|
|
@@ -0,0 +1,226 @@
|
|
|
1
|
+
import { Container } from "./styles";
|
|
2
|
+
import { LogoImage } from "../../atoms/LogoImage/index";
|
|
3
|
+
import { ScreenHeader } from "../../atoms/ScreenHeader/index";
|
|
4
|
+
import { Button } from "../../atoms/GeneralButton/index";
|
|
5
|
+
import { CheckBox } from "../../atoms/CheckBox/index";
|
|
6
|
+
import { TagAndInput } from "../TagAndInput";
|
|
7
|
+
import { FontFamily, GlobalColors } from "../../../global-files/variables";
|
|
8
|
+
import { useState, useEffect } from "react";
|
|
9
|
+
import { LogoLoading } from "../LogoLoading";
|
|
10
|
+
import { Redirect } from "react-router-dom";
|
|
11
|
+
import showPassword from "../../../assets/images/editField/showPassword.png";
|
|
12
|
+
import axios from "axios";
|
|
13
|
+
|
|
14
|
+
export const SignInLogin = (props) => {
|
|
15
|
+
const [emptyEmail, setEmptyEmail] = useState(false);
|
|
16
|
+
const [invalidEmail, setInvalidEmail] = useState(false);
|
|
17
|
+
const [emptyPassword, setEmptyPassword] = useState(false);
|
|
18
|
+
const [showErrors, setShowErrors] = useState(true);
|
|
19
|
+
const [signInError, setSignInError] = useState("");
|
|
20
|
+
const [loading, setLoading] = useState(false);
|
|
21
|
+
const [upgradePlanRedirect, setUpgradePlanRedirect] = useState(false);
|
|
22
|
+
|
|
23
|
+
const validate = async (e) => {
|
|
24
|
+
setSignInError("");
|
|
25
|
+
setShowErrors(true);
|
|
26
|
+
e.preventDefault();
|
|
27
|
+
let valid = true;
|
|
28
|
+
const email = document.querySelector("#emailInput").value.trim();
|
|
29
|
+
const password = document.querySelector("#passwordInput").value;
|
|
30
|
+
!/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9-]+(?:\.[a-zA-Z0-9-]+)*$/.test(
|
|
31
|
+
email
|
|
32
|
+
)
|
|
33
|
+
? setInvalidEmail(true)
|
|
34
|
+
: setInvalidEmail(false);
|
|
35
|
+
if (email === "") {
|
|
36
|
+
valid = false;
|
|
37
|
+
setEmptyEmail(true);
|
|
38
|
+
} else {
|
|
39
|
+
setEmptyEmail(false);
|
|
40
|
+
}
|
|
41
|
+
if (password === "") {
|
|
42
|
+
valid = false;
|
|
43
|
+
setEmptyPassword(true);
|
|
44
|
+
} else {
|
|
45
|
+
setEmptyPassword(false);
|
|
46
|
+
}
|
|
47
|
+
if (valid) {
|
|
48
|
+
try {
|
|
49
|
+
setLoading(true);
|
|
50
|
+
const session = await props.Auth.signIn(email, password);
|
|
51
|
+
if (session.challengeName === "NEW_PASSWORD_REQUIRED") {
|
|
52
|
+
props.setUser(session);
|
|
53
|
+
props.setPaso(8);
|
|
54
|
+
} else {
|
|
55
|
+
const userGroup =
|
|
56
|
+
session.signInUserSession.accessToken.payload["cognito:groups"];
|
|
57
|
+
const response = await axios.get(
|
|
58
|
+
process.env.REACT_APP_USER_ENDPOINT,
|
|
59
|
+
{
|
|
60
|
+
headers: {
|
|
61
|
+
Authorization: session.signInUserSession.idToken.jwtToken,
|
|
62
|
+
},
|
|
63
|
+
}
|
|
64
|
+
);
|
|
65
|
+
if (userGroup[0] === props.users) {
|
|
66
|
+
sessionStorage.setItem("auth", true);
|
|
67
|
+
sessionStorage.setItem(
|
|
68
|
+
"jwt",
|
|
69
|
+
session.signInUserSession.idToken.jwtToken
|
|
70
|
+
);
|
|
71
|
+
const user = JSON.parse(response.data.body).data[0];
|
|
72
|
+
const company = JSON.parse(response.data.body).data[1];
|
|
73
|
+
caches.keys().then((names) => {
|
|
74
|
+
names.forEach((name) => {
|
|
75
|
+
caches.delete(name);
|
|
76
|
+
});
|
|
77
|
+
});
|
|
78
|
+
user.src = `https://${
|
|
79
|
+
process.env.REACT_APP_IMAGES_PROFILE_BUCKET
|
|
80
|
+
}.s3.amazonaws.com/id-${user.id_user}/${
|
|
81
|
+
user.id_user
|
|
82
|
+
}.png?${new Date().getTime()}`;
|
|
83
|
+
sessionStorage.setItem("user", JSON.stringify(user));
|
|
84
|
+
sessionStorage.setItem("company", JSON.stringify(company));
|
|
85
|
+
setUpgradePlanRedirect(true);
|
|
86
|
+
} else {
|
|
87
|
+
setSignInError("NotAuthorizedException");
|
|
88
|
+
setLoading(false);
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
} catch (error) {
|
|
92
|
+
console.log(error.code);
|
|
93
|
+
setLoading(false);
|
|
94
|
+
if (error.code === "NotAuthorizedException") {
|
|
95
|
+
setSignInError("NotAuthorizedException");
|
|
96
|
+
} else if (error.code === "UserNotConfirmedException") {
|
|
97
|
+
sessionStorage.setItem("email", JSON.stringify(email));
|
|
98
|
+
props.setPaso(5);
|
|
99
|
+
} else {
|
|
100
|
+
setSignInError("Error");
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
};
|
|
105
|
+
|
|
106
|
+
useEffect(() => {
|
|
107
|
+
sessionStorage.getItem("resetPasswordProcess") &&
|
|
108
|
+
sessionStorage.removeItem("resetPasswordProcess");
|
|
109
|
+
}, []);
|
|
110
|
+
useEffect(() => {
|
|
111
|
+
if (upgradePlanRedirect) setLoading(false);
|
|
112
|
+
}, [upgradePlanRedirect]);
|
|
113
|
+
|
|
114
|
+
const closeEye = (e) => {
|
|
115
|
+
const input = document.getElementById("passwordInput");
|
|
116
|
+
const eye = document.getElementById("Eye");
|
|
117
|
+
if (input.type === "password") {
|
|
118
|
+
input.type = "text";
|
|
119
|
+
eye.style.opacity = 0.8;
|
|
120
|
+
} else {
|
|
121
|
+
input.type = "password";
|
|
122
|
+
eye.style.opacity = 0.2;
|
|
123
|
+
}
|
|
124
|
+
};
|
|
125
|
+
|
|
126
|
+
return loading ? (
|
|
127
|
+
<LogoLoading />
|
|
128
|
+
) : (
|
|
129
|
+
<>
|
|
130
|
+
<Container className={"home-login"}>
|
|
131
|
+
<div className="main-container">
|
|
132
|
+
<LogoImage />
|
|
133
|
+
<div className="credenciales">
|
|
134
|
+
<ScreenHeader
|
|
135
|
+
fontFamily={FontFamily.AvenirNext}
|
|
136
|
+
color={GlobalColors.s5}
|
|
137
|
+
text={"Ingresa tus credenciales"}
|
|
138
|
+
/>
|
|
139
|
+
</div>
|
|
140
|
+
<div className="user">
|
|
141
|
+
<TagAndInput
|
|
142
|
+
inputType={"text"}
|
|
143
|
+
label={"Nombre de usuario"}
|
|
144
|
+
inputPlaceHolder={"username@contentoh.com"}
|
|
145
|
+
inputId={"emailInput"}
|
|
146
|
+
/>
|
|
147
|
+
</div>
|
|
148
|
+
{showErrors && emptyEmail && <label>Ingrese su correo</label>}
|
|
149
|
+
{invalidEmail && !emptyEmail && (
|
|
150
|
+
<label>Ingrese un correo válido</label>
|
|
151
|
+
)}
|
|
152
|
+
<div className="password">
|
|
153
|
+
<TagAndInput
|
|
154
|
+
inputType={"password"}
|
|
155
|
+
label={"Contraseña"}
|
|
156
|
+
inputPlaceHolder={"Escribe tu contraseña"}
|
|
157
|
+
inputId={"passwordInput"}
|
|
158
|
+
/>
|
|
159
|
+
<img
|
|
160
|
+
src={showPassword}
|
|
161
|
+
alt="show password"
|
|
162
|
+
className="icon"
|
|
163
|
+
id="Eye"
|
|
164
|
+
onClick={(e) => {
|
|
165
|
+
closeEye(e);
|
|
166
|
+
}}
|
|
167
|
+
></img>
|
|
168
|
+
</div>
|
|
169
|
+
{showErrors && emptyPassword && <label>Ingrese su contraseña</label>}
|
|
170
|
+
<div className="select">
|
|
171
|
+
<CheckBox
|
|
172
|
+
label={"Mantener sesión activada"}
|
|
173
|
+
id={"chk-default"}
|
|
174
|
+
className="active-left"
|
|
175
|
+
/>
|
|
176
|
+
<p onClick={() => props.setPaso(10)} className="active-right">
|
|
177
|
+
Olvide mi contraseña
|
|
178
|
+
</p>
|
|
179
|
+
</div>
|
|
180
|
+
{showErrors && signInError === "NotAuthorizedException" && (
|
|
181
|
+
<label>Correo o contraseña incorrectos</label>
|
|
182
|
+
)}
|
|
183
|
+
{showErrors && signInError === "Error" && (
|
|
184
|
+
<label>Ha habido un problema al iniciar sesión</label>
|
|
185
|
+
)}
|
|
186
|
+
<div className="button-right">
|
|
187
|
+
<Button
|
|
188
|
+
buttonType={"general-default-button"}
|
|
189
|
+
label={"Iniciar sesión"}
|
|
190
|
+
onClick={(e) => validate(e)}
|
|
191
|
+
/>
|
|
192
|
+
</div>
|
|
193
|
+
{props.registration && (
|
|
194
|
+
<div className="new-login">
|
|
195
|
+
<p
|
|
196
|
+
className="pre-registro"
|
|
197
|
+
onClick={() => {
|
|
198
|
+
props.setPaso(1);
|
|
199
|
+
sessionStorage.setItem(
|
|
200
|
+
"nuevoRegistro",
|
|
201
|
+
JSON.stringify({
|
|
202
|
+
name: "",
|
|
203
|
+
lastName: "",
|
|
204
|
+
email: "",
|
|
205
|
+
position: "",
|
|
206
|
+
country: "",
|
|
207
|
+
phone: "",
|
|
208
|
+
commercialName: "",
|
|
209
|
+
companyName: "",
|
|
210
|
+
rfc: "",
|
|
211
|
+
adress: "",
|
|
212
|
+
})
|
|
213
|
+
);
|
|
214
|
+
sessionStorage.setItem("countryCode", JSON.stringify("+52"));
|
|
215
|
+
}}
|
|
216
|
+
>
|
|
217
|
+
¿Aún no tienes cuenta?<span> Regístrate</span>
|
|
218
|
+
</p>
|
|
219
|
+
</div>
|
|
220
|
+
)}
|
|
221
|
+
</div>
|
|
222
|
+
</Container>
|
|
223
|
+
{upgradePlanRedirect && <Redirect to={{ pathname: "/dashboard" }} />}
|
|
224
|
+
</>
|
|
225
|
+
);
|
|
226
|
+
};
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
import styled from "styled-components";
|
|
2
|
+
import { FontFamily, GlobalColors } from "../../../global-files/variables";
|
|
3
|
+
|
|
4
|
+
export const Container = styled.div`
|
|
5
|
+
background: "white";
|
|
6
|
+
display: flex;
|
|
7
|
+
height: 100vh;
|
|
8
|
+
width: 50%;
|
|
9
|
+
justify-content: center;
|
|
10
|
+
align-items: center;
|
|
11
|
+
label {
|
|
12
|
+
color: red;
|
|
13
|
+
margin-top: 3px;
|
|
14
|
+
margin-left: 15px;
|
|
15
|
+
font-family: ${FontFamily.Raleway_700};
|
|
16
|
+
font-size: 11px;
|
|
17
|
+
& + * {
|
|
18
|
+
margin-top: 12px;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
&.home-login {
|
|
23
|
+
.credenciales {
|
|
24
|
+
& + * {
|
|
25
|
+
margin-top: 30px;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
.user {
|
|
29
|
+
& + * {
|
|
30
|
+
margin-top: 45px;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
.password {
|
|
34
|
+
& + * {
|
|
35
|
+
margin-top: 20px;
|
|
36
|
+
}
|
|
37
|
+
&:hover {
|
|
38
|
+
border: 1px solid ${GlobalColors.magenta_s2};
|
|
39
|
+
}
|
|
40
|
+
display: flex;
|
|
41
|
+
justify-content: center;
|
|
42
|
+
align-items: center;
|
|
43
|
+
height: 40px;
|
|
44
|
+
position: relative;
|
|
45
|
+
width: 100%;
|
|
46
|
+
border: 1px solid ${GlobalColors.s2};
|
|
47
|
+
.input-container {
|
|
48
|
+
h2 {
|
|
49
|
+
position: absolute;
|
|
50
|
+
top: -25px;
|
|
51
|
+
left: 0;
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
#passwordInput {
|
|
55
|
+
width: 100%;
|
|
56
|
+
background-color: white;
|
|
57
|
+
position: absolute;
|
|
58
|
+
top: 8px;
|
|
59
|
+
left: 0;
|
|
60
|
+
right: 0;
|
|
61
|
+
bottom: 8px;
|
|
62
|
+
box-sizing: border-box;
|
|
63
|
+
border: none;
|
|
64
|
+
}
|
|
65
|
+
.icon {
|
|
66
|
+
position: absolute;
|
|
67
|
+
height: 60%;
|
|
68
|
+
position: absolute;
|
|
69
|
+
top: 50%;
|
|
70
|
+
right: 8px;
|
|
71
|
+
transform: translateY(-50%);
|
|
72
|
+
opacity: 0.3;
|
|
73
|
+
cursor: pointer;
|
|
74
|
+
}
|
|
75
|
+
.icon:hover {
|
|
76
|
+
opacity: 0.8;
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
.select {
|
|
80
|
+
display: flex;
|
|
81
|
+
justify-content: space-between;
|
|
82
|
+
.active-right {
|
|
83
|
+
font-family: ${FontFamily.AvenirNext};
|
|
84
|
+
font-weight: 500;
|
|
85
|
+
font-size: 13px;
|
|
86
|
+
line-height: 24px;
|
|
87
|
+
letter-spacing: -0.015em;
|
|
88
|
+
color: ${GlobalColors.s5};
|
|
89
|
+
cursor: pointer;
|
|
90
|
+
}
|
|
91
|
+
& + * {
|
|
92
|
+
margin-top: 50px;
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
.button-right {
|
|
96
|
+
text-align: right;
|
|
97
|
+
& + * {
|
|
98
|
+
margin-top: 55px;
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
.new-login {
|
|
102
|
+
p {
|
|
103
|
+
font-family: ${FontFamily.AvenirNext};
|
|
104
|
+
text-align: right;
|
|
105
|
+
font-weight: 500;
|
|
106
|
+
font-size: 13px;
|
|
107
|
+
line-height: 24px;
|
|
108
|
+
color: ${GlobalColors.s5};
|
|
109
|
+
cursor: pointer;
|
|
110
|
+
span {
|
|
111
|
+
color: ${GlobalColors.secondary_magenta};
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
.main-container {
|
|
117
|
+
max-width: 80%;
|
|
118
|
+
max-height: 80%;
|
|
119
|
+
}
|
|
120
|
+
`;
|
|
@@ -20,6 +20,7 @@ export const TagAndInput = ({
|
|
|
20
20
|
inputCols,
|
|
21
21
|
inputRows,
|
|
22
22
|
maxChar,
|
|
23
|
+
required,
|
|
23
24
|
}) => {
|
|
24
25
|
return (
|
|
25
26
|
<Container
|
|
@@ -45,6 +46,7 @@ export const TagAndInput = ({
|
|
|
45
46
|
inputCols={inputCols}
|
|
46
47
|
inputRows={inputRows}
|
|
47
48
|
maxChar={maxChar}
|
|
49
|
+
required={required}
|
|
48
50
|
/>
|
|
49
51
|
</Container>
|
|
50
52
|
);
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { VerificationCodeResetPasswordLogin } from "./index";
|
|
2
|
+
|
|
3
|
+
export default {
|
|
4
|
+
title: "Components/molecules/VerificationCodeResetPasswordLogin",
|
|
5
|
+
component: VerificationCodeResetPasswordLogin,
|
|
6
|
+
};
|
|
7
|
+
const Template = (args) => <VerificationCodeResetPasswordLogin {...args} />;
|
|
8
|
+
|
|
9
|
+
export const VerificationCodeResetPasswordLoginDefault = Template.bind({});
|
|
10
|
+
|
|
11
|
+
VerificationCodeResetPasswordLoginDefault.args = {};
|
|
@@ -0,0 +1,171 @@
|
|
|
1
|
+
import { Container } from "./styles";
|
|
2
|
+
import { GradientPanel } from "../../atoms/GradientPanel";
|
|
3
|
+
import { useEffect, useState } from "react";
|
|
4
|
+
import { LogoImage } from "../../atoms/LogoImage";
|
|
5
|
+
import { ScreenHeader } from "../../atoms/ScreenHeader";
|
|
6
|
+
import { GlobalColors, FontFamily } from "../../../global-files/variables";
|
|
7
|
+
import { GeneralInput } from "../../atoms/GeneralInput";
|
|
8
|
+
import { Button } from "../../atoms/GeneralButton";
|
|
9
|
+
import { validateInput, validate } from "./utils";
|
|
10
|
+
|
|
11
|
+
export const VerificationCodeResetPasswordLogin = (props) => {
|
|
12
|
+
const [resend, setResend] = useState(false);
|
|
13
|
+
const [awsError, setAwsError] = useState("");
|
|
14
|
+
const [emptyVerificationCode, setEmptyVerificationCode] = useState(false);
|
|
15
|
+
const [inputCodeVerificationAll, setInputCodeVerificationAll] = useState(
|
|
16
|
+
document.querySelectorAll("[id^='verificationCodeInput']")
|
|
17
|
+
);
|
|
18
|
+
const inputPositions = [1, 2, 3, 4, 5, 6];
|
|
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
|
+
setEmptyVerificationCode(false);
|
|
58
|
+
setResend(true);
|
|
59
|
+
} catch (err) {
|
|
60
|
+
setAwsError(err.code);
|
|
61
|
+
console.log(err.message);
|
|
62
|
+
}
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
useEffect(() => {
|
|
66
|
+
setInputCodeVerificationAll(
|
|
67
|
+
document.querySelectorAll("[id^='verificationCodeInput']")
|
|
68
|
+
);
|
|
69
|
+
}, []);
|
|
70
|
+
|
|
71
|
+
const loginRight = [
|
|
72
|
+
<LogoImage key="1" />,
|
|
73
|
+
<div className="credenciales" key={"2"}>
|
|
74
|
+
<ScreenHeader
|
|
75
|
+
fontFamily={FontFamily.AvenirNext}
|
|
76
|
+
color={GlobalColors.s5}
|
|
77
|
+
text={"Ingresa tus credenciales"}
|
|
78
|
+
/>
|
|
79
|
+
</div>,
|
|
80
|
+
<div className="user" key="3">
|
|
81
|
+
{sessionStorage.getItem("email") && (
|
|
82
|
+
<ScreenHeader
|
|
83
|
+
text={`Ingrese el código de verificación enviado a: ${JSON.parse(
|
|
84
|
+
sessionStorage.getItem("email")
|
|
85
|
+
)}`}
|
|
86
|
+
headerType={"input-name-header"}
|
|
87
|
+
/>
|
|
88
|
+
)}
|
|
89
|
+
{!sessionStorage.getItem("email") && (
|
|
90
|
+
<ScreenHeader
|
|
91
|
+
text={`Ingrese código de verificación enviado a: ${
|
|
92
|
+
JSON.parse(sessionStorage.getItem("nuevoRegistro")).email
|
|
93
|
+
}`}
|
|
94
|
+
headerType={"input-name-header"}
|
|
95
|
+
/>
|
|
96
|
+
)}
|
|
97
|
+
<div className="verification-code">
|
|
98
|
+
{inputPositions.map((position) => (
|
|
99
|
+
<GeneralInput
|
|
100
|
+
inputId={`verificationCodeInput${position}`}
|
|
101
|
+
inputType={"text"}
|
|
102
|
+
inputPlaceholder={"X"}
|
|
103
|
+
validateInput={validateInput}
|
|
104
|
+
inputsArray={inputCodeVerificationAll}
|
|
105
|
+
position={position}
|
|
106
|
+
maxLength="1"
|
|
107
|
+
/>
|
|
108
|
+
))}
|
|
109
|
+
</div>
|
|
110
|
+
{emptyVerificationCode && (
|
|
111
|
+
<label>Ingrese su código de verificación</label>
|
|
112
|
+
)}
|
|
113
|
+
{sessionStorage.getItem("resetError") && (
|
|
114
|
+
<label>Código de verifiación incorrecto</label>
|
|
115
|
+
)}
|
|
116
|
+
{props.confirmationError === "LimitExceededException" &&
|
|
117
|
+
!emptyVerificationCode && (
|
|
118
|
+
<label>Haz realizado demasiados intentos, intentalo más tarde</label>
|
|
119
|
+
)}
|
|
120
|
+
{props.confirmationError === "CodeMismatchException" &&
|
|
121
|
+
!emptyVerificationCode && (
|
|
122
|
+
<label>Código de verificación incorrecto</label>
|
|
123
|
+
)}
|
|
124
|
+
{props.confirmationError === "ExpiredCodeException" &&
|
|
125
|
+
!emptyVerificationCode && (
|
|
126
|
+
<label>El código ingresado está expirado</label>
|
|
127
|
+
)}
|
|
128
|
+
{props.confirmationError === "InternalErrorException" &&
|
|
129
|
+
!emptyVerificationCode && (
|
|
130
|
+
<label>Algo salió mal, porfavor vuelva a intentarlo</label>
|
|
131
|
+
)}
|
|
132
|
+
{awsError === "LimitExceededException" && (
|
|
133
|
+
<label>Haz realizado demasiados intentos, intentalo más tarde</label>
|
|
134
|
+
)}
|
|
135
|
+
{awsError === "InternalErrorException" && (
|
|
136
|
+
<label>Algo salió mal, porfavor vuelva a intentarlo</label>
|
|
137
|
+
)}
|
|
138
|
+
{resend && awsError === "" && (
|
|
139
|
+
<label className="resendTrue">
|
|
140
|
+
Se reenvió el código de verificación correctamente
|
|
141
|
+
</label>
|
|
142
|
+
)}
|
|
143
|
+
</div>,
|
|
144
|
+
<div className="resend-code" key="4">
|
|
145
|
+
<p onClick={(e) => validateResend(e)}>Reenviar código de verificación</p>
|
|
146
|
+
</div>,
|
|
147
|
+
<div className="button-center" key="5">
|
|
148
|
+
<Button
|
|
149
|
+
buttonType={"general-default-button"}
|
|
150
|
+
label={"Enviar"}
|
|
151
|
+
onClick={(e) => {
|
|
152
|
+
let flag = validate(inputCodeVerificationAll);
|
|
153
|
+
checkCode(e, flag);
|
|
154
|
+
setEmptyVerificationCode(flag);
|
|
155
|
+
}}
|
|
156
|
+
/>
|
|
157
|
+
</div>,
|
|
158
|
+
<div className="reset-password" key="6">
|
|
159
|
+
<p onClick={() => props.setPaso(10)}>Regresar...</p>
|
|
160
|
+
</div>,
|
|
161
|
+
];
|
|
162
|
+
return (
|
|
163
|
+
<Container>
|
|
164
|
+
<GradientPanel
|
|
165
|
+
componentsArray={loginRight}
|
|
166
|
+
panelType={"home-login"}
|
|
167
|
+
panelColor={GlobalColors.white}
|
|
168
|
+
/>
|
|
169
|
+
</Container>
|
|
170
|
+
);
|
|
171
|
+
};
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import styled from "styled-components";
|
|
2
|
+
import { FontFamily, GlobalColors } from "../../../global-files/variables";
|
|
3
|
+
|
|
4
|
+
export const Container = styled.div`
|
|
5
|
+
display: flex;
|
|
6
|
+
height: 100vh;
|
|
7
|
+
width: 50%;
|
|
8
|
+
align-items: center;
|
|
9
|
+
justify-content: center;
|
|
10
|
+
.button-center {
|
|
11
|
+
text-align: center;
|
|
12
|
+
.general-default-button {
|
|
13
|
+
width: 160px;
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
.reset-password {
|
|
17
|
+
text-align: center;
|
|
18
|
+
margin: 15px !important;
|
|
19
|
+
color: ${GlobalColors.secondary_magenta};
|
|
20
|
+
cursor: pointer;
|
|
21
|
+
font-weight: bold;
|
|
22
|
+
font-family: ${FontFamily.Raleway};
|
|
23
|
+
font-size: 13px;
|
|
24
|
+
}
|
|
25
|
+
.resend-code {
|
|
26
|
+
margin-top: 8px !important;
|
|
27
|
+
color: ${GlobalColors.magenta_s2};
|
|
28
|
+
font-family: ${FontFamily.AvenirNext};
|
|
29
|
+
font-size: 11px;
|
|
30
|
+
text-decoration: underline rgb(228, 81, 172);
|
|
31
|
+
cursor: pointer;
|
|
32
|
+
& + * {
|
|
33
|
+
margin-top: 30px;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
.verification-code {
|
|
37
|
+
display: flex;
|
|
38
|
+
text-align: center;
|
|
39
|
+
margin: auto;
|
|
40
|
+
margin-top: 10px;
|
|
41
|
+
input[type="number"]::-webkit-inner-spin-button,
|
|
42
|
+
input[type="number"]::-webkit-outer-spin-button {
|
|
43
|
+
-webkit-appearance: none;
|
|
44
|
+
margin: 0;
|
|
45
|
+
}
|
|
46
|
+
input {
|
|
47
|
+
width: 70%;
|
|
48
|
+
text-align: center;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
.resendTrue{
|
|
52
|
+
color: ${GlobalColors.exported};
|
|
53
|
+
}
|
|
54
|
+
`;
|