修复南网登录时明文密码问题

This commit is contained in:
BianLzhaoMin 2024-10-08 10:19:38 +08:00
parent 54a2d757da
commit ac39997809
8 changed files with 7602 additions and 5478 deletions

View File

@ -18,7 +18,7 @@ class HttpConfig {
// baseUrl = "https://z.csgmall.com.cn/gl"
// baseUrl = "http://192.168.2.160:39080" // 梁超
// baseUrl = "http://192.168.2.218:39080" // 福
target = "http://192.168.2.74:49080"; // 开发阶段后台ip
target = "http://192.168.2.158:49080"; // 开发阶段后台ip
// #endif
// 基地址 (部署时使用 需要加 dev-api
// authPath = `${this.baseUrl}/dev-api/auth`

5
node_modules/.package-lock.json generated vendored
View File

@ -106,6 +106,11 @@
"node": ">= 0.4"
}
},
"node_modules/jsencrypt": {
"version": "3.3.2",
"resolved": "https://repo.huaweicloud.com/repository/npm/jsencrypt/-/jsencrypt-3.3.2.tgz",
"integrity": "sha512-arQR1R1ESGdAxY7ZheWr12wCaF2yF47v5qpB76TtV64H1pyGudk9Hvw8Y9tb/FiTIaaTRUyaSnm5T/Y53Ghm/A=="
},
"node_modules/object-inspect": {
"version": "1.13.1",
"resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.13.1.tgz",

6
package-lock.json generated
View File

@ -5,6 +5,7 @@
"packages": {
"": {
"dependencies": {
"jsencrypt": "^3.3.2",
"qs": "^6.11.2",
"uni-read-pages": "^1.0.5",
"uni-simple-router": "^2.0.8-beta.4"
@ -113,6 +114,11 @@
"node": ">= 0.4"
}
},
"node_modules/jsencrypt": {
"version": "3.3.2",
"resolved": "https://repo.huaweicloud.com/repository/npm/jsencrypt/-/jsencrypt-3.3.2.tgz",
"integrity": "sha512-arQR1R1ESGdAxY7ZheWr12wCaF2yF47v5qpB76TtV64H1pyGudk9Hvw8Y9tb/FiTIaaTRUyaSnm5T/Y53Ghm/A=="
},
"node_modules/object-inspect": {
"version": "1.13.1",
"resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.13.1.tgz",

View File

@ -1,5 +1,6 @@
{
"dependencies": {
"jsencrypt": "^3.3.2",
"qs": "^6.11.2",
"uni-read-pages": "^1.0.5",
"uni-simple-router": "^2.0.8-beta.4"

View File

@ -127,7 +127,10 @@
<script>
import { authPath, publicPath, systemPath } from "../../public";
import store from "../../store/user";
import { Mcaptcha } from "../../utils/mcaptcha";
// import { encrypt } from "../../utils/jsencrypt";
import { encrypt } from "../../utils/jsencrypt";
// import { Mcaptcha } from "../../utils/mcaptcha";
export default {
data() {
return {
@ -394,7 +397,8 @@
let that = this;
that.$refs.accountForm.validate().then((formData) => {
that.showLoading = true;
console.log(formData);
formData.password = encrypt(formData.password);
// console.log("", formData);
that.$api.login
.log(formData)
.then(async (res) => {

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load Diff

23
utils/jsencrypt.js Normal file
View File

@ -0,0 +1,23 @@
import JSEncrypt from "jsencrypt/bin/jsencrypt.min";
// 密钥对生成 http://web.chacuo.net/netrsakeypair
const publicKey =
"MFwwDQYJKoZIhvcNAQEBBQADSwAwSAJBAKoR8mX0rGKLqzcWmOzbfj64K8ZIgOdHnzkXSOVOZbFu/TJhZ7rFAN+eaGkl3C4buccQd/EjEsj9ir7ijT7h96MCAwEAAQ==";
const privateKey =
"MIIBVAIBADANBgkqhkiG9w0BAQEFAASCAT4wggE6AgEAAkEAqhHyZfSsYourNxaY7Nt+PrgrxkiA50efORdI5U5lsW79MmFnusUA355oaSXcLhu5xxB38SMSyP2KvuKNPuH3owIDAQABAkAfoiLyL+Z4lf4Myxk6xUDgLaWGximj20CUf+5BKKnlrK+Ed8gAkM0HqoTt2UZwA5E2MzS4EI2gjfQhz5X28uqxAiEA3wNFxfrCZlSZHb0gn2zDpWowcSxQAgiCstxGUoOqlW8CIQDDOerGKH5OmCJ4Z21v+F25WaHYPxCFMvwxpcw99EcvDQIgIdhDTIqD2jfYjPTY8Jj3EDGPbH2HHuffvflECt3Ek60CIQCFRlCkHpi7hthhYhovyloRYsM+IS9h/0BzlEAuO0ktMQIgSPT3aFAgJYwKpqRYKlLDVcflZFCKY7u3UP8iWi1Qw0Y=";
// 加密
export function encrypt(txt) {
const encryptor = new JSEncrypt();
encryptor.setPublicKey(publicKey); // 设置公钥
return encryptor.encrypt(txt); // 对数据进行加密
}
// 解密
export function decrypt(txt) {
const encryptor = new JSEncrypt();
encryptor.setPrivateKey(privateKey); // 设置私钥
return encryptor.decrypt(txt); // 对数据进行解密
}