mdkcontroller 1.4.12 → 1.4.16
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/login/index.html
CHANGED
|
@@ -223,8 +223,9 @@
|
|
|
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
|
-
const form =
|
|
228
|
+
const form = el('formLogin');
|
|
228
229
|
const formData = new FormData(form);
|
|
229
230
|
DK.RequestLoginBySW(formData.get('passwordChange') || '');
|
|
230
231
|
}
|
|
@@ -23,7 +23,38 @@ export default function () {
|
|
|
23
23
|
return null;
|
|
24
24
|
}
|
|
25
25
|
}
|
|
26
|
-
const
|
|
26
|
+
const validateBaseByToken = function (accessToken) {
|
|
27
|
+
const db = global.db;
|
|
28
|
+
const tbUser = db.data.users;
|
|
29
|
+
|
|
30
|
+
if (accessToken) {
|
|
31
|
+
const jwtValidate = hideverifyJWT(accessToken);
|
|
32
|
+
if (!jwtValidate) {
|
|
33
|
+
return -1;
|
|
34
|
+
}
|
|
35
|
+
const userName = jwtValidate.username;
|
|
36
|
+
if (!userName) {
|
|
37
|
+
return -1;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
let userO = userCache.get(userName);
|
|
41
|
+
|
|
42
|
+
if (!userO) {
|
|
43
|
+
userO = tbUser.find(f => f.username === userName);
|
|
44
|
+
if (!userO) return -1;
|
|
45
|
+
|
|
46
|
+
userCache.set(userName, userO);
|
|
47
|
+
}
|
|
48
|
+
if (userO.signcode != jwtValidate.signcode) {
|
|
49
|
+
return -1;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
return 1;
|
|
53
|
+
} else {
|
|
54
|
+
return 0;
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
const validateBase = function (req, res) {
|
|
27
58
|
const db = global.db;
|
|
28
59
|
const tbUser = db.data.users;
|
|
29
60
|
|
|
@@ -78,6 +109,9 @@ export default function () {
|
|
|
78
109
|
validateBool: (req, res) => {
|
|
79
110
|
return validateBase(req, res);
|
|
80
111
|
},
|
|
112
|
+
validateByToken: (accessToken) => {
|
|
113
|
+
return validateBaseByToken(accessToken);
|
|
114
|
+
},
|
|
81
115
|
encrypt: function (data = "", pw = "mdkpaswoEcrHidDefat") {
|
|
82
116
|
return encrypt(data, pw);
|
|
83
117
|
},
|