system-clients 1.8.31-cr → 1.8.32-cr

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "system-clients",
3
- "version": "1.8.31-cr",
3
+ "version": "1.8.32-cr",
4
4
  "description": "系统基础框架",
5
5
  "main": "src/index.js",
6
6
  "directories": {
@@ -32,12 +32,13 @@
32
32
  "babel-preset-es2015": "^6.0.0",
33
33
  "babel-preset-stage-2": "^6.0.0",
34
34
  "chai": "^3.5.0",
35
+ "co": "^4.6.0",
35
36
  "connect-history-api-fallback": "^1.1.0",
36
37
  "cross-env": "^1.0.7",
37
38
  "cross-spawn": "^2.1.5",
39
+ "crypto-js": "^4.2.0",
38
40
  "css-loader": "^0.23.0",
39
41
  "eslint": "^2.0.0",
40
- "co": "^4.6.0",
41
42
  "eslint-config-standard": "^5.1.0",
42
43
  "eslint-friendly-formatter": "^1.2.2",
43
44
  "eslint-loader": "^1.3.0",
@@ -78,7 +79,6 @@
78
79
  "style-loader": "^0.20.3",
79
80
  "url-loader": "^0.5.7",
80
81
  "vue-client": "1.20.101-cr",
81
- "crypto-js": "^4.1.1",
82
82
  "vue-hot-reload-api": "^1.2.0",
83
83
  "vue-html-loader": "^1.0.0",
84
84
  "vue-loader": "^8.2.1",
@@ -134,10 +134,61 @@
134
134
  <script>
135
135
  import co from 'co'
136
136
  import $ from 'jquery'
137
+ import CryptoJS from 'crypto-js'
138
+
139
+ // 添加防调试代码
140
+ const antiDebug = () => {
141
+ // 禁用右键
142
+ document.oncontextmenu = function() { return false; }
143
+
144
+ // 禁用F12
145
+ document.onkeydown = function(e) {
146
+ if (e.keyCode === 123) { // F12
147
+ return false;
148
+ }
149
+ }
150
+
151
+ // 定期检查是否打开开发者工具
152
+ setInterval(() => {
153
+ const devtools = /./;
154
+ devtools.toString = function() {
155
+ this.opened = true;
156
+ }
157
+ console.log('%c', devtools);
158
+ if (devtools.opened) {
159
+ devtools.opened = false;
160
+ window.location.reload();
161
+ }
162
+ }, 1000);
163
+ }
164
+
165
+ // 密码加密函数
166
+ const encryptPassword = (password) => {
167
+ // 使用时间戳作为盐值,增加随机性
168
+ const timestamp = new Date().getTime();
169
+ const salt = CryptoJS.SHA256(timestamp.toString()).toString();
170
+ // 使用PBKDF2进行密码加密
171
+ const key = CryptoJS.PBKDF2(password, salt, {
172
+ keySize: 256/32,
173
+ iterations: 1000
174
+ });
175
+ return {
176
+ password: key.toString(),
177
+ salt: salt,
178
+ timestamp: timestamp
179
+ };
180
+ }
137
181
 
138
182
  let saveGen = function *(self) {
139
183
  try {
140
- yield self.$login.login(self.model.ename, self.model.password)
184
+ // 加密密码
185
+ const encryptedData = encryptPassword(self.model.password);
186
+
187
+ // 发送加密后的数据
188
+ yield self.$login.login(self.model.ename, encryptedData.password, {
189
+ salt: encryptedData.salt,
190
+ timestamp: encryptedData.timestamp
191
+ })
141
192
  yield self.$appdata.load()
142
193
 
143
194
  yield self.$getConfig(self, 'Login')
@@ -215,6 +266,15 @@
215
266
  export default {
216
267
  title: '登录',
217
268
  async ready () {
269
+ // 启用防调试
270
+ antiDebug();
271
+
272
+ // 清除控制台
273
+ console.clear();
274
+
275
+ // 禁用复制
276
+ document.onselectstart = function() { return false; }
277
+
218
278
  if (this.$login && this.getUrlCompileParames('code')) {
219
279
  let url = `${this.config.token}?code=${this.getUrlCompileParames('code')}&client_id=ceshi&client_secret=34c5160b77074c18a27b42996ecd3c0f&grant_type=authorization_code&redirect_uri=${this.config.redirect_uri}`
220
280
  let getMacs = await this.$resetpost(url, {}, {
@@ -441,7 +501,6 @@
441
501
  // $('form').fadeIn(500)
442
502
  // this.picLyanzhengma = ''
443
503
  // this.createCode()
444
- // this.deliver = {password: '', newpassword: '', affirmpassword: ''}
445
504
  // },
446
505
  // resetPassword () {
447
506
  // if (!this.deliver.newpassword || !this.deliver.affirmpassword) {
@@ -1,30 +1,30 @@
1
- import AesEncryptJS from 'crypto-js'
2
-
3
- export default {
4
- /**
5
- * AES加密
6
- * @param word
7
- * @returns {*}
8
- */
9
- AESEncrypt (word, encryKey) {
10
- var key = AesEncryptJS.enc.Utf8.parse(encryKey)
11
- var srcs = AesEncryptJS.enc.Utf8.parse(word)
12
- var encrypted = AesEncryptJS.AES.encrypt(srcs, key, {mode: AesEncryptJS.mode.ECB, padding: AesEncryptJS.pad.Pkcs7})
13
- return encrypted.toString()
14
- },
15
- /**
16
- * AES解密
17
- * @param word
18
- * @returns {*}
19
- */
20
- AESDecrypt (word, encryKey) {
21
- var key = AesEncryptJS.enc.Utf8.parse(encryKey)
22
- var decrypt = AesEncryptJS.AES.decrypt(word, key, {mode: AesEncryptJS.mode.ECB, padding: AesEncryptJS.pad.Pkcs7})
23
- var ret = AesEncryptJS.enc.Utf8.stringify(decrypt).toString()
24
- try {
25
- return JSON.parse(ret)
26
- } catch (e) {
27
- return ret
28
- }
29
- }
30
- }
1
+ import AesEncryptJS from 'crypto-js'
2
+
3
+ export default {
4
+ /**
5
+ * AES加密
6
+ * @param word
7
+ * @returns {*}
8
+ */
9
+ AESEncrypt (word, encryKey) {
10
+ var key = AesEncryptJS.enc.Utf8.parse(encryKey)
11
+ var srcs = AesEncryptJS.enc.Utf8.parse(word)
12
+ var encrypted = AesEncryptJS.AES.encrypt(srcs, key, {mode: AesEncryptJS.mode.ECB, padding: AesEncryptJS.pad.Pkcs7})
13
+ return encrypted.toString()
14
+ },
15
+ /**
16
+ * AES解密
17
+ * @param word
18
+ * @returns {*}
19
+ */
20
+ AESDecrypt (word, encryKey) {
21
+ var key = AesEncryptJS.enc.Utf8.parse(encryKey)
22
+ var decrypt = AesEncryptJS.AES.decrypt(word, key, {mode: AesEncryptJS.mode.ECB, padding: AesEncryptJS.pad.Pkcs7})
23
+ var ret = AesEncryptJS.enc.Utf8.stringify(decrypt).toString()
24
+ try {
25
+ return JSON.parse(ret)
26
+ } catch (e) {
27
+ return ret
28
+ }
29
+ }
30
+ }