Browse Source

登录接口加密

seimin 1 year ago
parent
commit
386122625a
1 changed files with 11 additions and 0 deletions
  1. 11 0
      pages/homePage/homePage.vue

+ 11 - 0
pages/homePage/homePage.vue

@@ -164,6 +164,16 @@
164
         });
164
         });
165
         return tmpAES.toString();
165
         return tmpAES.toString();
166
       },
166
       },
167
+      //aes加密-登录
168
+      encryptByEnAES(data) {
169
+        data = enc.Utf8.parse(data);
170
+        let Key = enc.Utf8.parse('Aes2Util666AQWER');
171
+        let tmpAES = AES.encrypt(data, Key, {
172
+          mode: mode.ECB,
173
+          padding: pad.Pkcs7,
174
+        });
175
+        return tmpAES.toString();
176
+      },
167
       //aes解密
177
       //aes解密
168
       encryptByDeAES(data) {
178
       encryptByDeAES(data) {
169
         let Key = "dsadmin";
179
         let Key = "dsadmin";
@@ -687,6 +697,7 @@
687
           password: this.password.trim(),
697
           password: this.password.trim(),
688
           type: 'APP'
698
           type: 'APP'
689
         };
699
         };
700
+        data = this.encryptByEnAES(JSON.stringify(data));
690
         post("/auth/login", data).then((res) => {
701
         post("/auth/login", data).then((res) => {
691
           uni.hideLoading();
702
           uni.hideLoading();
692
           if (res.status == 200) {
703
           if (res.status == 200) {