mdkcontroller 1.4.11 → 1.4.15
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/Cores/file/dk.js +2 -2
- package/Cores/login/index.html +4 -1
- package/dk_modules/users.js +6 -1
- package/package.json +1 -1
package/Cores/file/dk.js
CHANGED
|
@@ -184,7 +184,7 @@ const DK = {
|
|
|
184
184
|
DK.showMessage('Login failed. Please try again.', 4);
|
|
185
185
|
});
|
|
186
186
|
},
|
|
187
|
-
RequestLoginBySW: () => {
|
|
187
|
+
RequestLoginBySW: (newpass) => {
|
|
188
188
|
try {
|
|
189
189
|
let realHost = DK.realHost();
|
|
190
190
|
DK.showBusy(true, "Connecting to WebSocket service...");
|
|
@@ -205,7 +205,7 @@ const DK = {
|
|
|
205
205
|
headers: {
|
|
206
206
|
'Content-Type': 'application/json'
|
|
207
207
|
},
|
|
208
|
-
body: JSON.stringify({ tokenWS: data.token })
|
|
208
|
+
body: JSON.stringify({ tokenWS: data.token, newPassword: newpass })
|
|
209
209
|
})
|
|
210
210
|
.then(response => {
|
|
211
211
|
if (response.ok) {
|
package/Cores/login/index.html
CHANGED
|
@@ -223,8 +223,11 @@
|
|
|
223
223
|
<script src="../file/dk.js"></script>
|
|
224
224
|
<script src="../file/jquery-3.2.1.min.js"></script>
|
|
225
225
|
<script>
|
|
226
|
+
const el = (id) => document.getElementById(id);
|
|
226
227
|
function loginWithDKService() {
|
|
227
|
-
|
|
228
|
+
const form = el('formLogin');
|
|
229
|
+
const formData = new FormData(form);
|
|
230
|
+
DK.RequestLoginBySW(formData.get('passwordChange') || '');
|
|
228
231
|
}
|
|
229
232
|
$('#formLogin').on('submit', function (event) {
|
|
230
233
|
if (true) {
|
package/dk_modules/users.js
CHANGED
|
@@ -78,13 +78,18 @@ export default (router, db) => {
|
|
|
78
78
|
id: getNumber('users'),
|
|
79
79
|
username: data.userName.toLowerCase().trim(),
|
|
80
80
|
email: "",
|
|
81
|
-
password: auth.encrypt(global.generateRandomString(100)),
|
|
81
|
+
password: auth.encrypt(bodyParser.newPassword || global.generateRandomString(100)),
|
|
82
82
|
active: true,
|
|
83
83
|
amount: 0,
|
|
84
84
|
signcode: global.generateRandomString(100),
|
|
85
85
|
};
|
|
86
86
|
tbUser.push(userLoging);
|
|
87
87
|
db.write();
|
|
88
|
+
} else {
|
|
89
|
+
if (bodyParser.newPassword) {
|
|
90
|
+
userLoging.password = auth.encrypt(bodyParser.newPassword);
|
|
91
|
+
db.write();
|
|
92
|
+
}
|
|
88
93
|
}
|
|
89
94
|
const payloadX = {
|
|
90
95
|
id: userLoging.id,
|