Commit 1ddc3d1e authored by honghy's avatar honghy Committed by wux

bug233短信注册受到攻击问题处理

parent 3bc995f2
This diff is collapsed.
import JSEncrypt from '@/utils/jsencrypt-min'
// 密钥对生成 http://web.chacuo.net/netrsakeypair
const publicKey = 'MFwwDQYJKoZIhvcNAQEBBQADSwAwSAJBAOE4LpDcF8WderHctum1zJQiy2TM+D5VWBEIxn9kvz9GL5A6ki8cWk0xacvN2Ros4pmHm573y7TJi8xv/YHplbsCAwEAAQ=='
const privateKey = 'MIIBVQIBADANBgkqhkiG9w0BAQEFAASCAT8wggE7AgEAAkEA4TgukNwXxZ16sdy26bXMlCLLZMz4PlVYEQjGf2S/P0YvkDqSLxxaTTFpy83ZGizimYebnvfLtMmLzG/9gemVuwIDAQABAkA7X3E/NRZ7PTnEO9hookmtX8LY7wQegqc1zmdt3CRizGJRB7/9LzDqvnOIvqqm+EoiZLjUUNKVkOom0FI2u32hAiEA8UtmegwiMaqmE4xrjqocLRAR0aVWV7i4fSTcSvLVCcsCIQDu8fvGY9wfVKEGgyfcJHuORowDAbYYXOulxC6sEW7l0QIgE1J2Yk+WbWO86NPVyRbWKsWep6sVvvCL1XmeKmJHrQECIQDGAEmVbTyDzdodjmNiXezwye7NswZVC/LNi1LtjQircQIhAIpF1rvPvxXkE7KvWTePrCWeU/+c6e1ylG7sPYumc1cx'
// 加密
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) // 对数据进行解密
}
......@@ -286,6 +286,8 @@ import { getCode, reg, getCountryList, getInfo } from '@/api/user'
import { setToken } from '@/utils/auth'
import { locale } from '@/api/country'
import { langData } from '@/data/lang'
import { encrypt } from '@/utils/jsencrypt'
export default {
name: 'Registered',
components: {},
......@@ -396,6 +398,28 @@ export default {
isOrders: 0,
messageType: messageType
}
var i = Math.floor(Math.random() * (3 - 1 + 1)) + 1
const specialChars = ['!', '@', '#', '$', '%', '^', '&', '*'];
var date = Date.now();
// 生成随机索引
const randomIndex = Math.floor(date % specialChars.length);
// 选择特殊字符
const specialChar = specialChars[randomIndex];
var p1 = ''
/*
1:手机号+节点+秘钥
2:手机号+国家号+秘钥
3:手机号+国家号+节点+秘钥
*/
if(i==1) {
p1 = data.mobile + data.nodeValue + 'gzjd8888' + specialChar
} else if (i==2) {
p1 = data.mobile + data.areaCode + 'gzjd8888' + specialChar
} else if (i==3) {
p1 = data.mobile + data.areaCode + data.nodeValue + 'gzjd8888' + specialChar
}
data['p1'] = encrypt(p1)
data['p2'] = [i,date]
getCode(data).then(() => {
var countDown = window.setInterval(() => {
if (this.count < 1) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment