@visns-studio/visns-components 1.8.5 → 2.0.1
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/.prettierrc.json +7 -0
- package/components/cms/{visns-data-grid.jsx → DataGrid.jsx} +2 -2
- package/components/cms/DropZone.jsx +161 -0
- package/components/cms/Field.jsx +747 -0
- package/components/cms/Form.jsx +475 -0
- package/components/cms/sorting/{list.jsx → List.jsx} +3 -3
- package/components/crm/{visns-async-select.jsx → AsyncSelect.jsx} +9 -9
- package/components/crm/Call.jsx +220 -0
- package/components/crm/{visns-data-grid.jsx → DataGrid.jsx} +263 -277
- package/components/crm/{visns-field.jsx → Field.jsx} +5 -5
- package/components/crm/{visns-form.jsx → Form.jsx} +302 -205
- package/components/crm/{visns-multi-select.jsx → MultiSelect.jsx} +1 -1
- package/components/crm/{visns-navigation.jsx → Navigation.jsx} +22 -18
- package/components/crm/{visns-notification.jsx → Notification.jsx} +1 -1
- package/components/crm/TableFilter.jsx +125 -0
- package/components/crm/auth/Login.jsx +158 -0
- package/components/crm/auth/Profile.jsx +163 -0
- package/components/crm/auth/Reset.jsx +87 -0
- package/components/crm/auth/Verify.jsx +162 -0
- package/components/crm/generic/GenericDetail.jsx +563 -0
- package/components/crm/generic/GenericIndex.jsx +112 -0
- package/components/crm/generic/NotificationList.jsx +64 -0
- package/index.js +37 -19
- package/package.json +13 -7
- package/components/cms/visns-dropzone.jsx +0 -161
- package/components/cms/visns-field.jsx +0 -747
- package/components/cms/visns-form.jsx +0 -475
- package/components/crm/visns-call.jsx +0 -220
- package/components/crm/visns-table-filter.jsx +0 -153
- /package/components/cms/sorting/{item.jsx → Item.jsx} +0 -0
- /package/components/crm/{visns-autocomplete.jsx → Autocomplete.jsx} +0 -0
- /package/components/crm/{visns-download.jsx → Download.jsx} +0 -0
- /package/components/crm/{visns-fetch.jsx → Fetch.jsx} +0 -0
- /package/components/crm/{visns-loader.jsx → Loader.jsx} +0 -0
- /package/components/crm/{visns-select.jsx → Select.jsx} +0 -0
- /package/components/crm/{visns-select-list.jsx → SelectList.jsx} +0 -0
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
import React, { useState } from 'react';
|
|
2
|
+
import { useNavigate, useParams } from 'react-router-dom';
|
|
3
|
+
import { toast } from 'react-toastify';
|
|
4
|
+
import parse from 'html-react-parser';
|
|
5
|
+
import validator from 'validator';
|
|
6
|
+
import Reveal from 'react-reveal/Reveal';
|
|
7
|
+
|
|
8
|
+
import CustomFetch from '../Fetch';
|
|
9
|
+
|
|
10
|
+
const Verify = () => {
|
|
11
|
+
const navigate = useNavigate();
|
|
12
|
+
const { code } = useParams();
|
|
13
|
+
|
|
14
|
+
const [formData, setFormData] = useState({
|
|
15
|
+
password: '',
|
|
16
|
+
passwordRepeat: '',
|
|
17
|
+
passwordClass: '',
|
|
18
|
+
passwordRepeatClass: '',
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
const { password, passwordRepeat, passwordClass, passwordRepeatClass } =
|
|
22
|
+
formData;
|
|
23
|
+
|
|
24
|
+
const handleInputChange = (e) => {
|
|
25
|
+
const { name, value } = e.target;
|
|
26
|
+
setFormData((prevFormData) => ({
|
|
27
|
+
...prevFormData,
|
|
28
|
+
[name]: value,
|
|
29
|
+
passwordClass: '',
|
|
30
|
+
passwordRepeatClass: '',
|
|
31
|
+
}));
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
const validatePassword = () => {
|
|
35
|
+
let _error = '';
|
|
36
|
+
|
|
37
|
+
if (password === '') {
|
|
38
|
+
_error = 'Please type in your new password.';
|
|
39
|
+
setFormData((prevFormData) => ({
|
|
40
|
+
...prevFormData,
|
|
41
|
+
passwordClass: 'inputError',
|
|
42
|
+
}));
|
|
43
|
+
} else {
|
|
44
|
+
if (password !== passwordRepeat) {
|
|
45
|
+
_error =
|
|
46
|
+
'The password does not match, please re-type the password.';
|
|
47
|
+
setFormData((prevFormData) => ({
|
|
48
|
+
...prevFormData,
|
|
49
|
+
passwordClass: 'inputError',
|
|
50
|
+
passwordRepeatClass: 'inputError',
|
|
51
|
+
}));
|
|
52
|
+
} else {
|
|
53
|
+
if (!validator.isStrongPassword(password)) {
|
|
54
|
+
_error =
|
|
55
|
+
'Your password is too weak it must contain the following:<br />- Must contain at least 8 characters.<br />- Must contain at least one uppercase letter.<br />- Must contain at least one lowercase letter.<br />- Must contain at least one number.<br />- Must contain at least one symbol.<br />';
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
return _error;
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
const handleSubmit = (e) => {
|
|
64
|
+
if (e) {
|
|
65
|
+
e.preventDefault();
|
|
66
|
+
const errorMsg = validatePassword();
|
|
67
|
+
|
|
68
|
+
if (errorMsg === '') {
|
|
69
|
+
CustomFetch(
|
|
70
|
+
'/password/reset',
|
|
71
|
+
'POST',
|
|
72
|
+
{
|
|
73
|
+
code: code,
|
|
74
|
+
password: password,
|
|
75
|
+
password_confirmation: passwordRepeat,
|
|
76
|
+
},
|
|
77
|
+
function (result) {
|
|
78
|
+
if (result.error === '') {
|
|
79
|
+
toast.success(
|
|
80
|
+
'You have successfully set a new password, please use your new password to login into the system.'
|
|
81
|
+
);
|
|
82
|
+
|
|
83
|
+
navigate('/login');
|
|
84
|
+
} else {
|
|
85
|
+
toast.error(result.error);
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
);
|
|
89
|
+
} else {
|
|
90
|
+
toast.error(<div>{parse(errorMsg)}</div>);
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
};
|
|
94
|
+
|
|
95
|
+
return (
|
|
96
|
+
<div className="lcontainer">
|
|
97
|
+
<div className="lwrap">
|
|
98
|
+
<aside className="aside"></aside>
|
|
99
|
+
<div className="logincontainer">
|
|
100
|
+
<form onSubmit={handleSubmit}>
|
|
101
|
+
<Reveal effect="fadeInUp">
|
|
102
|
+
<div className="login">
|
|
103
|
+
<div className="formItem fwItem">
|
|
104
|
+
<h1>Reset your password</h1>
|
|
105
|
+
</div>
|
|
106
|
+
{errorMsg === '' ? (
|
|
107
|
+
<>
|
|
108
|
+
<div className="formItem fwItem">
|
|
109
|
+
<label className="fi__label">
|
|
110
|
+
<input
|
|
111
|
+
type="password"
|
|
112
|
+
name="password"
|
|
113
|
+
value={password}
|
|
114
|
+
onChange={handleInputChange}
|
|
115
|
+
tabIndex="1"
|
|
116
|
+
className={passwordClass}
|
|
117
|
+
/>
|
|
118
|
+
<span className="fi__span">
|
|
119
|
+
Password
|
|
120
|
+
</span>
|
|
121
|
+
</label>
|
|
122
|
+
</div>
|
|
123
|
+
<div className="formItem fwItem">
|
|
124
|
+
<label className="fi__label">
|
|
125
|
+
<input
|
|
126
|
+
type="password"
|
|
127
|
+
name="passwordRepeat"
|
|
128
|
+
value={passwordRepeat}
|
|
129
|
+
onChange={handleInputChange}
|
|
130
|
+
tabIndex="2"
|
|
131
|
+
className={
|
|
132
|
+
passwordRepeatClass
|
|
133
|
+
}
|
|
134
|
+
/>
|
|
135
|
+
<span className="fi__span">
|
|
136
|
+
Re-type Password
|
|
137
|
+
</span>
|
|
138
|
+
</label>
|
|
139
|
+
</div>
|
|
140
|
+
<div className="formItem fwItem lastItem">
|
|
141
|
+
<button
|
|
142
|
+
className="btn"
|
|
143
|
+
type="submit"
|
|
144
|
+
tabIndex="3"
|
|
145
|
+
>
|
|
146
|
+
Reset
|
|
147
|
+
</button>
|
|
148
|
+
</div>
|
|
149
|
+
</>
|
|
150
|
+
) : (
|
|
151
|
+
<p>{errorMsg}</p>
|
|
152
|
+
)}
|
|
153
|
+
</div>
|
|
154
|
+
</Reveal>
|
|
155
|
+
</form>
|
|
156
|
+
</div>
|
|
157
|
+
</div>
|
|
158
|
+
</div>
|
|
159
|
+
);
|
|
160
|
+
};
|
|
161
|
+
|
|
162
|
+
export default Verify;
|