@visns-studio/visns-components 5.4.7 → 5.4.9
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/README.md +527 -67
- package/package.json +4 -3
- package/src/components/crm/Navigation.jsx +19 -4
- package/src/components/crm/auth/Login.jsx +38 -4
- package/src/components/crm/auth/Profile.jsx +861 -176
- package/src/components/crm/auth/TwoFactorAuth.jsx +223 -60
- package/src/components/crm/auth/styles/Login.module.scss +36 -0
- package/src/components/crm/auth/styles/Profile.module.scss +469 -20
- package/src/components/crm/auth/styles/TwoFactorAuth.module.scss +37 -1
- package/src/components/crm/generic/styles/GenericDynamic.module.scss +7 -1
- package/src/components/crm/generic/styles/GenericFormBuilder.module.scss +7 -1
- package/src/components/styles/global.css +75 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import '../../styles/global.css';
|
|
2
2
|
|
|
3
|
-
import React, {
|
|
3
|
+
import React, { useState } from 'react';
|
|
4
4
|
import { Link, useLocation, useNavigate } from 'react-router-dom';
|
|
5
5
|
import Reveal from 'react-reveal/Reveal';
|
|
6
6
|
import { toast } from 'react-toastify';
|
|
@@ -19,6 +19,7 @@ const Login = ({ logo, providers, setSystemAuth, setUserProfile }) => {
|
|
|
19
19
|
email: '',
|
|
20
20
|
password: '',
|
|
21
21
|
location: location,
|
|
22
|
+
remember: false,
|
|
22
23
|
});
|
|
23
24
|
|
|
24
25
|
const [authClass, setAuthClass] = useState({
|
|
@@ -83,9 +84,13 @@ const Login = ({ logo, providers, setSystemAuth, setUserProfile }) => {
|
|
|
83
84
|
|
|
84
85
|
const handleChange = (e) => {
|
|
85
86
|
if (e) {
|
|
87
|
+
const value =
|
|
88
|
+
e.target.type === 'checkbox'
|
|
89
|
+
? e.target.checked
|
|
90
|
+
: e.target.value;
|
|
86
91
|
setAuth((prevState) => ({
|
|
87
92
|
...prevState,
|
|
88
|
-
[e.target.name]:
|
|
93
|
+
[e.target.name]: value,
|
|
89
94
|
}));
|
|
90
95
|
}
|
|
91
96
|
};
|
|
@@ -111,13 +116,14 @@ const Login = ({ logo, providers, setSystemAuth, setUserProfile }) => {
|
|
|
111
116
|
setIsLoading(false);
|
|
112
117
|
if (result.error === '') {
|
|
113
118
|
// Check if 2FA is required
|
|
114
|
-
if (result.
|
|
115
|
-
// Redirect to 2FA page with user data
|
|
119
|
+
if (result.requires_two_factor) {
|
|
120
|
+
// Redirect to 2FA page with user data and remember flag
|
|
116
121
|
navigate('/2fa', {
|
|
117
122
|
state: {
|
|
118
123
|
userData: result.user,
|
|
119
124
|
previousUrl:
|
|
120
125
|
location.state?.previousUrl || '',
|
|
126
|
+
remember: auth.remember,
|
|
121
127
|
},
|
|
122
128
|
});
|
|
123
129
|
} else {
|
|
@@ -221,6 +227,34 @@ const Login = ({ logo, providers, setSystemAuth, setUserProfile }) => {
|
|
|
221
227
|
</small>
|
|
222
228
|
</label>
|
|
223
229
|
</div>
|
|
230
|
+
<div
|
|
231
|
+
className={`${styles.formItem} ${styles.fwItem}`}
|
|
232
|
+
>
|
|
233
|
+
<div className={styles.rememberMeContainer}>
|
|
234
|
+
<div
|
|
235
|
+
className={
|
|
236
|
+
styles.rememberMeCheckboxWrapper
|
|
237
|
+
}
|
|
238
|
+
>
|
|
239
|
+
<input
|
|
240
|
+
type="checkbox"
|
|
241
|
+
id="rememberMe"
|
|
242
|
+
name="remember"
|
|
243
|
+
checked={auth.remember}
|
|
244
|
+
onChange={handleChange}
|
|
245
|
+
className={
|
|
246
|
+
styles.rememberMeCheckbox
|
|
247
|
+
}
|
|
248
|
+
/>
|
|
249
|
+
</div>
|
|
250
|
+
<label
|
|
251
|
+
htmlFor="rememberMe"
|
|
252
|
+
className={styles.rememberMeLabel}
|
|
253
|
+
>
|
|
254
|
+
Remember me
|
|
255
|
+
</label>
|
|
256
|
+
</div>
|
|
257
|
+
</div>
|
|
224
258
|
<div
|
|
225
259
|
className={`${styles.formItem} ${styles.fwItem} ${styles.lastItem}`}
|
|
226
260
|
>
|