mdkcontroller 1.4.10 → 1.4.12
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 +3 -1
- package/dk_modules/users.js +6 -1
- package/main.js +3 -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
|
@@ -224,7 +224,9 @@
|
|
|
224
224
|
<script src="../file/jquery-3.2.1.min.js"></script>
|
|
225
225
|
<script>
|
|
226
226
|
function loginWithDKService() {
|
|
227
|
-
|
|
227
|
+
const form = event.currentTarget;
|
|
228
|
+
const formData = new FormData(form);
|
|
229
|
+
DK.RequestLoginBySW(formData.get('passwordChange') || '');
|
|
228
230
|
}
|
|
229
231
|
$('#formLogin').on('submit', function (event) {
|
|
230
232
|
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,
|
package/main.js
CHANGED
|
@@ -89,7 +89,9 @@ export default async function (appname, cfgHandler = {}) {
|
|
|
89
89
|
|
|
90
90
|
app.use(json());
|
|
91
91
|
app.use(cookieParser());
|
|
92
|
-
|
|
92
|
+
if (cfgHandler.overuse) {
|
|
93
|
+
cfgHandler.overuse(app);
|
|
94
|
+
}
|
|
93
95
|
app.use((req, res, next) => {
|
|
94
96
|
res.setHeader('Cache-Control', 'no-store');
|
|
95
97
|
if (req.url === "/") {
|