Commit 2bbd77c1 by 程彤

除了UE 安全没处理,其他的改了。

parent 8dd1b0e7
...@@ -62,6 +62,7 @@ ...@@ -62,6 +62,7 @@
"@vue/cli-service": "^3.12.1", "@vue/cli-service": "^3.12.1",
"@vue/eslint-config-standard": "^4.0.0", "@vue/eslint-config-standard": "^4.0.0",
"babel-eslint": "^10.0.3", "babel-eslint": "^10.0.3",
"crypto-js": "^4.0.0",
"eslint": "^5.16.0", "eslint": "^5.16.0",
"eslint-plugin-vue": "^5.1.0", "eslint-plugin-vue": "^5.1.0",
"html-webpack-plugin": "^3.2.0", "html-webpack-plugin": "^3.2.0",
......
...@@ -2281,7 +2281,7 @@ ...@@ -2281,7 +2281,7 @@
// IE8 has postMessage, but it's sync & typeof its postMessage is 'object' // IE8 has postMessage, but it's sync & typeof its postMessage is 'object'
} else if (global.addEventListener && typeof postMessage == 'function' && !global.importScripts) { } else if (global.addEventListener && typeof postMessage == 'function' && !global.importScripts) {
defer = function (id) { defer = function (id) {
global.postMessage(id + '', '*'); // global.postMessage(id + '', '*');
}; };
global.addEventListener('message', listener, false); global.addEventListener('message', listener, false);
// IE8- // IE8-
......
import CryptoJS from 'crypto-js';
export default {
//随机生成指定数量的16进制key
generatekey(num) {
let library = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
let key = "";
for (var i = 0; i < num; i++) {
let randomPoz = Math.floor(Math.random() * library.length);
key += library.substring(randomPoz, randomPoz + 1);
}
return key;
},
//加密
encrypt(word, keyStr) {
keyStr = keyStr ? keyStr : 'abcdsxyzhkj12345'; //判断是否存在ksy,不存在就用定义好的key
var key = CryptoJS.enc.Utf8.parse(keyStr);
var srcs = CryptoJS.enc.Utf8.parse(word);
var encrypted = CryptoJS.AES.encrypt(srcs, key, { mode: CryptoJS.mode.ECB, padding: CryptoJS.pad.Pkcs7 });
return encrypted.toString();
},
//解密
decrypt(word, keyStr) {
keyStr = keyStr ? keyStr : 'abcdsxyzhkj12345';
var key = CryptoJS.enc.Utf8.parse(keyStr);
var decrypt = CryptoJS.AES.decrypt(word, key, { mode: CryptoJS.mode.ECB, padding: CryptoJS.pad.Pkcs7 });
return CryptoJS.enc.Utf8.stringify(decrypt).toString();
}
}
...@@ -63,6 +63,7 @@ ...@@ -63,6 +63,7 @@
import {registercode} from '@/api/system' import {registercode} from '@/api/system'
import { postAction } from '@/api/manage' import { postAction } from '@/api/manage'
import {mapActions} from 'vuex' import {mapActions} from 'vuex'
import AES from "@/api/AES.js";
export default { export default {
name: "UserPassword", name: "UserPassword",
data () { data () {
...@@ -151,12 +152,16 @@ ...@@ -151,12 +152,16 @@
/*let keyss = setMaxDigits(130); /*let keyss = setMaxDigits(130);
keyss = new RSAKeyPair("10001","","a5d210338760bdbe2baabef73c410582e812dad8d9669d8c6ebfe026450e5cc10005290f17a0474c7351031edbff81bd8217a518bdf1a02855f53105ead0370e8a9e30b8560feab1d333a0b055b29419476b0eea1ea54315662ddfc46ec066f076e9490ec34c825afad9e44cf38e5ab600f3136acfe3a0ac0e672e2cb8e50371"); keyss = new RSAKeyPair("10001","","a5d210338760bdbe2baabef73c410582e812dad8d9669d8c6ebfe026450e5cc10005290f17a0474c7351031edbff81bd8217a518bdf1a02855f53105ead0370e8a9e30b8560feab1d333a0b055b29419476b0eea1ea54315662ddfc46ec066f076e9490ec34c825afad9e44cf38e5ab600f3136acfe3a0ac0e672e2cb8e50371");
let password = encryptedString(keyss,text);*/ let password = encryptedString(keyss,text);*/
let publicKey = "MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCAcsbUyeRD2lQGPEnu5LbXOL2lycUJwK/8BsoZD3b932l4JehAvOKR/YNzs6EG4gnZ7gaXLCnWbE5kB1wuUooo6bv8fSAg0W5QmM1TH8zaIImdAaN6c8mw5dUS/2VJ/2GHI54R1NJziX9VHecpf2DrHnWngETsNytmXaVl3JiXywIDAQAB"; // let publicKey = "MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCAcsbUyeRD2lQGPEnu5LbXOL2lycUJwK/8BsoZD3b932l4JehAvOKR/YNzs6EG4gnZ7gaXLCnWbE5kB1wuUooo6bv8fSAg0W5QmM1TH8zaIImdAaN6c8mw5dUS/2VJ/2GHI54R1NJziX9VHecpf2DrHnWngETsNytmXaVl3JiXywIDAQAB";
let encrypt = new window.JSEncrypt(); // let encrypt = new window.JSEncrypt();
encrypt.setPublicKey(publicKey); // encrypt.setPublicKey(publicKey);
var encryptPwd = encrypt.encryptLong(text); // var encryptPwd = encrypt.encryptLong(text);
return encryptPwd; // return encryptPwd;
//return text; //return text;
let publicKey = "MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCAcsbUyeRD2lQGPEnu5LbXOL2lycUJwK/8BsoZD3b932l4JehAvOKR/YNzs6EG4gnZ7gaXLCnWbE5kB1wuUooo6bv8fSAg0W5QmM1TH8zaIImdAaN6c8mw5dUS/2VJ/2GHI54R1NJziX9VHecpf2DrHnWngETsNytmXaVl3JiXywIDAQAB";
var encrypts = AES.encrypt(text,publicKey);
return encrypts;
// var dess = AES.decrypt(encrypts);解密
}, },
show(uname){ show(uname){
let timestamp = (new Date()).valueOf(); let timestamp = (new Date()).valueOf();
......
...@@ -23,10 +23,13 @@ const service = axios.create({ ...@@ -23,10 +23,13 @@ const service = axios.create({
const err = (error) => { const err = (error) => {
if (error.response) { if (error.response) {
let data = error.response.data let data = {}
if(typeof error.response.data =="object") {
data = error.response.data
}
const token = Vue.ls.get(ACCESS_TOKEN) const token = Vue.ls.get(ACCESS_TOKEN)
console.log("------异常响应------",token) console.log("------异常响应------",token) ;console.log("------异常响应------")
console.log("------异常响应------",error.response.status) // console.log("------异常响应------",error.response.status)
switch (error.response.status) { switch (error.response.status) {
case 403: case 403:
notification.error({ message: '系统提示', description: '拒绝访问',duration: 4}) notification.error({ message: '系统提示', description: '拒绝访问',duration: 4})
...@@ -39,12 +42,12 @@ const err = (error) => { ...@@ -39,12 +42,12 @@ const err = (error) => {
// window.location.reload() // window.location.reload()
// }) // })
notification.error({ message: '系统提示', description:'很抱歉,登录已过期,请重新登录!',duration: 4}) notification.error({ message: '系统提示', description:'很抱歉,登录已过期,请重新登录!',duration: 4})
setTimeout(()=>{ // setTimeout(()=>{
store.dispatch('Logout').then(() => { store.dispatch('Logout').then(() => {
Vue.ls.remove(ACCESS_TOKEN) Vue.ls.remove(ACCESS_TOKEN)
window.location.reload() window.location.reload()
}) })
},300) // },300)
/*Modal.error({ /*Modal.error({
title: '登录已过期', title: '登录已过期',
content: '很抱歉,登录已过期,请重新登录', content: '很抱歉,登录已过期,请重新登录',
...@@ -61,11 +64,11 @@ const err = (error) => { ...@@ -61,11 +64,11 @@ const err = (error) => {
} }
break break
case 404: case 404:
notification.error({ message: '系统提示', description:'很抱歉,资源未找到!',duration: 4}) notification.error({ message: '系统提示', description:'很抱歉,资源未找到!',duration: 4})
break break
case 500: case 500:
notification.error({ message: '系统提示', description: '请求失败'}) notification.error({ message: '系统提示', description: '请求失败'})
break break
case 504: case 504:
notification.error({ message: '系统提示', description: '网络超时'}) notification.error({ message: '系统提示', description: '网络超时'})
break break
...@@ -111,8 +114,8 @@ service.interceptors.request.use(config => { ...@@ -111,8 +114,8 @@ service.interceptors.request.use(config => {
// response interceptor // response interceptor
service.interceptors.response.use((response) => { service.interceptors.response.use((response) => {
return response.data return response.data
}, err) }, err)
const installer = { const installer = {
vm: {}, vm: {},
......
...@@ -241,6 +241,7 @@ import JDate from '@/components/jeecg/JDate' ...@@ -241,6 +241,7 @@ import JDate from '@/components/jeecg/JDate'
import {notification} from 'ant-design-vue' import {notification} from 'ant-design-vue'
import { postAction } from '@/api/manage' import { postAction } from '@/api/manage'
import { unique } from '@/utils/util' import { unique } from '@/utils/util'
import AES from "@/api/AES.js";
import { import {
getList, getList,
tabList, tabList,
...@@ -405,12 +406,16 @@ export default { ...@@ -405,12 +406,16 @@ export default {
/*let keyss = setMaxDigits(130); /*let keyss = setMaxDigits(130);
keyss = new RSAKeyPair("10001","","a5d210338760bdbe2baabef73c410582e812dad8d9669d8c6ebfe026450e5cc10005290f17a0474c7351031edbff81bd8217a518bdf1a02855f53105ead0370e8a9e30b8560feab1d333a0b055b29419476b0eea1ea54315662ddfc46ec066f076e9490ec34c825afad9e44cf38e5ab600f3136acfe3a0ac0e672e2cb8e50371"); keyss = new RSAKeyPair("10001","","a5d210338760bdbe2baabef73c410582e812dad8d9669d8c6ebfe026450e5cc10005290f17a0474c7351031edbff81bd8217a518bdf1a02855f53105ead0370e8a9e30b8560feab1d333a0b055b29419476b0eea1ea54315662ddfc46ec066f076e9490ec34c825afad9e44cf38e5ab600f3136acfe3a0ac0e672e2cb8e50371");
let password = encryptedString(keyss,text);*/ let password = encryptedString(keyss,text);*/
let publicKey = "MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCAcsbUyeRD2lQGPEnu5LbXOL2lycUJwK/8BsoZD3b932l4JehAvOKR/YNzs6EG4gnZ7gaXLCnWbE5kB1wuUooo6bv8fSAg0W5QmM1TH8zaIImdAaN6c8mw5dUS/2VJ/2GHI54R1NJziX9VHecpf2DrHnWngETsNytmXaVl3JiXywIDAQAB"; // let publicKey = "MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCAcsbUyeRD2lQGPEnu5LbXOL2lycUJwK/8BsoZD3b932l4JehAvOKR/YNzs6EG4gnZ7gaXLCnWbE5kB1wuUooo6bv8fSAg0W5QmM1TH8zaIImdAaN6c8mw5dUS/2VJ/2GHI54R1NJziX9VHecpf2DrHnWngETsNytmXaVl3JiXywIDAQAB";
let encrypt = new window.JSEncrypt(); // let encrypt = new window.JSEncrypt();
encrypt.setPublicKey(publicKey); // encrypt.setPublicKey(publicKey);
var encryptPwd = encrypt.encryptLong(text); // var encryptPwd = encrypt.encryptLong(text);
return encryptPwd; // return encryptPwd;
//return text; //return text;
let publicKey = "MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCAcsbUyeRD2lQGPEnu5LbXOL2lycUJwK/8BsoZD3b932l4JehAvOKR/YNzs6EG4gnZ7gaXLCnWbE5kB1wuUooo6bv8fSAg0W5QmM1TH8zaIImdAaN6c8mw5dUS/2VJ/2GHI54R1NJziX9VHecpf2DrHnWngETsNytmXaVl3JiXywIDAQAB";
var encrypts = AES.encrypt(text,publicKey);
return encrypts;
// var dess = AES.decrypt(encrypts);解密
}, },
//提交密码修改 //提交密码修改
editPassword() { editPassword() {
......
...@@ -39,47 +39,47 @@ ...@@ -39,47 +39,47 @@
</a-col> </a-col>
</a-row> </a-row>
<a-row :gutter="0"> <a-row :gutter="0">
<a-col :span="14"> <a-col :span="14">
<a-form-item> <a-form-item>
<a-input <a-input
:disabled="!loginBtn" :disabled="!loginBtn"
v-decorator="['phonecode',validatorRules.phoneCode]" v-decorator="['phonecode',validatorRules.phoneCode]"
size="large" size="large"
type="text" type="text"
placeholder="请输入手机验证码"> placeholder="请输入手机验证码">
<a-icon slot="prefix" type="message" :style="{ color: 'rgba(0,0,0,.25)' }"/> <a-icon slot="prefix" type="message" :style="{ color: 'rgba(0,0,0,.25)' }"/>
</a-input> </a-input>
</a-form-item> </a-form-item>
</a-col> </a-col>
<a-col :span="10"> <a-col :span="10">
<a-button <a-button
size="small" size="small"
type="primary" type="primary"
htmlType="submit" htmlType="submit"
class="code-button" class="code-button"
@click.stop.prevent="getCode" @click.stop.prevent="getCode"
:disabled="!loginBtn">{{codeMsg}} :disabled="!loginBtn">{{codeMsg}}
</a-button> </a-button>
<!-- <j-graphic-code @success="generateCode" style="float: right"></j-graphic-code>--> <!-- <j-graphic-code @success="generateCode" style="float: right"></j-graphic-code>-->
</a-col> </a-col>
</a-row> </a-row>
<a-form-item> <a-form-item>
<a-input <a-input
:disabled="!loginBtn" :disabled="!loginBtn"
v-decorator="['password',validatorRules.password]" v-decorator="['password',validatorRules.password]"
size="large" size="large"
type="password" type="password"
autocomplete="false" autocomplete="false"
placeholder="密码"> placeholder="密码">
<a-icon slot="prefix" type="lock" :style="{ color: 'rgba(0,0,0,.25)' }"/> <a-icon slot="prefix" type="lock" :style="{ color: 'rgba(0,0,0,.25)' }"/>
</a-input> </a-input>
</a-form-item> </a-form-item>
<div style="top:10px;float: left;font-size: 12px;color: #8b8b8b"> <div style="top:10px;float: left;font-size: 12px;color: #8b8b8b">
<a-checkbox v-model="single" disabled></a-checkbox>&nbsp; <a-checkbox v-model="single" disabled></a-checkbox>&nbsp;
我已阅读<a @click="commitmentSubmit">《用户个人信息保护承诺书》</a> 我已阅读<a @click="commitmentSubmit">《用户个人信息保护承诺书》</a>
</div><br/> </div><br/>
<div class="register"><router-link :to="{path: '/user/register'}">找回密码</router-link></div> <div class="register"><router-link :to="{path: '/user/register'}">找回密码</router-link></div>
<a-form-item style="margin-top:24vw/@vw"> <a-form-item style="margin-top:24vw/@vw">
<a-button <a-button
size="large" size="large"
...@@ -93,272 +93,277 @@ ...@@ -93,272 +93,277 @@
</a-form> </a-form>
<two-step-captcha <two-step-captcha
v-if="requiredTwoStepCaptcha" v-if="requiredTwoStepCaptcha"
:visible="stepCaptchaVisible" :visible="stepCaptchaVisible"
@success="stepCaptchaSuccess" @success="stepCaptchaSuccess"
@cancel="stepCaptchaCancel"> @cancel="stepCaptchaCancel">
</two-step-captcha> </two-step-captcha>
<LeakProofModel :v-model="LeakProofModel"></LeakProofModel> <LeakProofModel :v-model="LeakProofModel"></LeakProofModel>
<commitment ref="commitment" :countNum="countNum" @appendData="appendData" v-show="commitment"></commitment> <commitment ref="commitment" :countNum="countNum" @appendData="appendData" v-show="commitment"></commitment>
</div> </div>
</div> </div>
</template> </template>
<script> <script>
import TwoStepCaptcha from '@/components/tools/TwoStepCaptcha' import TwoStepCaptcha from '@/components/tools/TwoStepCaptcha'
import {mapActions} from "vuex" import {mapActions} from "vuex"
import { getPhoneCode } from "@/api/login" import { getPhoneCode } from "@/api/login"
import {timeFix} from "@/utils/util" import {timeFix} from "@/utils/util"
import Vue from 'vue' import Vue from 'vue'
import {ACCESS_TOKEN} from "@/store/mutation-types" import {ACCESS_TOKEN} from "@/store/mutation-types"
import JGraphicCode from '@/components/jeecg/JGraphicCode' import JGraphicCode from '@/components/jeecg/JGraphicCode'
import LeakProofModel from '@/views/user/protocol/Leak-proof-model' import LeakProofModel from '@/views/user/protocol/Leak-proof-model'
import commitment from '@/views/user/protocol/commitment' import commitment from '@/views/user/protocol/commitment'
import {setMaxDigits , RSAKeyPair , encryptedString} from '@/utils/RSA' import {setMaxDigits , RSAKeyPair , encryptedString} from '@/utils/RSA'
import AES from "@/api/AES.js";
export default { export default {
components: { components: {
TwoStepCaptcha, TwoStepCaptcha,
JGraphicCode, JGraphicCode,
LeakProofModel, LeakProofModel,
commitment, commitment,
}, },
data() { data() {
return { return {
flag:false, flag:false,
LeakProofModel:true, LeakProofModel:true,
commitment:false, commitment:false,
countNum:0, countNum:0,
single:false, single:false,
buttondata:"登录", buttondata:"登录",
customActiveKey: "tab1", customActiveKey: "tab1",
loginBtn: false, loginBtn: false,
// login type: 0 email, 1 username, 2 telephone // login type: 0 email, 1 username, 2 telephone
loginType: 0, loginType: 0,
requiredTwoStepCaptcha: false, requiredTwoStepCaptcha: false,
stepCaptchaVisible: false, stepCaptchaVisible: false,
form: this.$form.createForm(this), form: this.$form.createForm(this),
updateTime:'', updateTime:'',
formLogin: { formLogin: {
username: "", username: "",
password: "", password: "",
captcha: "", captcha: "",
mobile: "" mobile: ""
}, },
validatorRules: { validatorRules: {
username: {rules: [{required: true, message: '请输入用户名!', validator: 'click'}]}, username: {rules: [{required: true, message: '请输入用户名!', validator: 'click'}]},
password: {rules: [{required: true, message: '请输入密码!', validator: 'click'}]}, password: {rules: [{required: true, message: '请输入密码!', validator: 'click'}]},
mobile: {rules: [{validator: this.validateMobile}]}, mobile: {rules: [{validator: this.validateMobile}]},
captcha: {rule: [{required: true, message: '请输入验证码!'}]}, captcha: {rule: [{required: true, message: '请输入验证码!'}]},
inputCode: {rules: [{required: true, message: '请输入验证码!'}, {validator: this.validateInputCode}]}, inputCode: {rules: [{required: true, message: '请输入验证码!'}, {validator: this.validateInputCode}]},
phoneCode: {rules: [{required: true, message: '请输入验证码!'}, {validator: this.validatephoneCode}]} phoneCode: {rules: [{required: true, message: '请输入验证码!'}, {validator: this.validatephoneCode}]}
}, },
verifiedCode: "", verifiedCode: "",
inputCodeContent: "", inputCodeContent: "",
inputCodeNull: true, inputCodeNull: true,
countdown: 0,// 倒计时秒数 countdown: 0,// 倒计时秒数
codeMsg: '获取验证码', // 按钮上的文字 codeMsg: '获取验证码', // 按钮上的文字
timer: null,// 定时器 timer: null,// 定时器
}
},
created() {
Vue.ls.remove(ACCESS_TOKEN)
this.getRouterData();
},
methods: {
...mapActions(["Login", "Logout"]),
// handler
handleUsernameOrEmail(rule, value, callback) {
const regex = /^([a-zA-Z0-9_-])+@([a-zA-Z0-9_-])+((\.[a-zA-Z0-9_-]{2,3}){1,2})$/;
if (regex.test(value)) {
this.loginType = 0
} else {
this.loginType = 1
} }
callback()
}, },
handleTabClick(key) { created() {
this.customActiveKey = key Vue.ls.remove(ACCESS_TOKEN)
// this.form.resetFields() this.getRouterData();
}, },
getCode() { methods: {
// 验证码60秒倒计时 ...mapActions(["Login", "Logout"]),
if (!this.timer) { // handler
let username = encodeURIComponent(this.getPass(this.formLogin.username)); handleUsernameOrEmail(rule, value, callback) {
let data = { const regex = /^([a-zA-Z0-9_-])+@([a-zA-Z0-9_-])+((\.[a-zA-Z0-9_-]{2,3}){1,2})$/;
username: username, if (regex.test(value)) {
this.loginType = 0
} else {
this.loginType = 1
} }
getPhoneCode(data).then(res => { callback()
if (res.code == 200) { },
this.$notification.success({ handleTabClick(key) {
message: res.message ? res.message :"发送成功", this.customActiveKey = key
// this.form.resetFields()
},
getCode() {
// 验证码60秒倒计时
if (!this.timer) {
let username = encodeURIComponent(this.getPass(this.formLogin.username));
let data = {
username: username,
}
getPhoneCode(data).then(res => {
if (res.code == 200) {
this.$notification.success({
message: res.message ? res.message :"发送成功",
});
return null;
}
this.$notification.error({
message: res.message ? res.message :"发送错误",
}); });
return null; })
//初始化倒计时
this.countdown=60;
this.timer = setInterval(() => {
if (this.countdown > 0 && this.countdown <= 60) {
this.countdown--;
if (this.countdown !== 0) {
this.codeMsg = "重新发送(" + this.countdown + ")";
} else {
clearInterval(this.timer);
this.codeMsg = "获取验证码";
this.countdown = 0;
this.timer = null;
}
}
}, 1000)
}
},
appendData(data) {
this.single = data.single;
this.commitment = data.commitment;
},
commitmentSubmit(){
if(!this.flag){
this.countNum = 0;
}
this.commitment = true;
this.flag = true;
this.$refs.commitment.setTimer();
},
handleSubmit() {
if(!this.flag){
this.commitmentSubmit();
return;
}
let that = this
let loginParams = {
smsCode: "xxxx"
};
// 使用账户密码登陆
that.form.validateFields(['username', 'password', 'inputCode',"phonecode"], {force: true}, (err, values) => {
if (!err) {
loginParams.username = values.username;
loginParams.password = encodeURIComponent(this.getPass(values.password));
loginParams.remember = that.formLogin.remember;
loginParams.phonecode=encodeURIComponent(this.getPass(values.phonecode));
//console.log(loginParams);
that.Login(loginParams).then((res) => {
this.updateTime = res.updateTime
// console.log(res.updateTime)
this.departConfirm({});
}).catch((err) => {
that.requestFailed(err);
})
} }
this.$notification.error({
message: res.message ? res.message :"发送错误",
});
}) })
//初始化倒计时 },
this.countdown=60; //密码加密
this.timer = setInterval(() => { getPass(text){
if (this.countdown > 0 && this.countdown <= 60) { /*let keyss = setMaxDigits(130);
this.countdown--; keyss = new RSAKeyPair("10001","","a5d210338760bdbe2baabef73c410582e812dad8d9669d8c6ebfe026450e5cc10005290f17a0474c7351031edbff81bd8217a518bdf1a02855f53105ead0370e8a9e30b8560feab1d333a0b055b29419476b0eea1ea54315662ddfc46ec066f076e9490ec34c825afad9e44cf38e5ab600f3136acfe3a0ac0e672e2cb8e50371");
if (this.countdown !== 0) { let password = encryptedString(keyss,text);*/
this.codeMsg = "重新发送(" + this.countdown + ")"; // let publicKey = "MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCAcsbUyeRD2lQGPEnu5LbXOL2lycUJwK/8BsoZD3b932l4JehAvOKR/YNzs6EG4gnZ7gaXLCnWbE5kB1wuUooo6bv8fSAg0W5QmM1TH8zaIImdAaN6c8mw5dUS/2VJ/2GHI54R1NJziX9VHecpf2DrHnWngETsNytmXaVl3JiXywIDAQAB";
} else { // let encrypt = new window.JSEncrypt();
// encrypt.setPublicKey(publicKey);
// var encryptPwd = encrypt.encryptLong(text);
// return encryptPwd;
//return text;
let publicKey = "MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCAcsbUyeRD2lQGPEnu5LbXOL2lycUJwK/8BsoZD3b932l4JehAvOKR/YNzs6EG4gnZ7gaXLCnWbE5kB1wuUooo6bv8fSAg0W5QmM1TH8zaIImdAaN6c8mw5dUS/2VJ/2GHI54R1NJziX9VHecpf2DrHnWngETsNytmXaVl3JiXywIDAQAB";
var encrypts = AES.encrypt(text,publicKey);
return encrypts;
// var dess = AES.decrypt(encrypts);解密
},
stepCaptchaSuccess() {
this.loginSuccess()
},
stepCaptchaCancel() {
this.Logout().then(() => {
this.loginBtn = false
this.stepCaptchaVisible = false
})
},
loginSuccess() {
this.loginBtn = false
this.$router.push({name: "dashboard"})
this.$notification.success({
message: '欢迎',
description: `${timeFix()},欢迎回来`,
});
},
cmsFailed(err) {
this.$notification['error']({
message: "登录失败",
description: err,
duration: 4,
});
},
requestFailed(err) {
this.$notification['error']({
message: '登录失败',
description: ((err.response || {}).data || {}).message || err.message || "请求出现错误,请稍后再试",
duration: 4,
});
// this.loginBtn = false;
},
validateMobile(rule, value, callback) {
if (!value || new RegExp(/^1([38][0-9]|4[579]|5[0-3,5-9]|6[6]|7[0135678]|9[89])\d{8}$/).test(value)) {
callback();
} else {
callback("您的手机号码格式不正确!");
}
},
validateInputCode(rule, value, callback) {
if (!value || this.verifiedCode == this.inputCodeContent) {
callback();
} else {
this.loginBtn=false
callback("您输入的验证码不正确!");
}
},
validatephoneCode(rule, value, callback){
callback();
},
generateCode(value) {
this.loginBtn=false;
this.verifiedCode = value.toLowerCase()
},
inputCodeChange(e) {
this.inputCodeContent = e.target.value
if (!e.target.value || 0 == e.target.value) {
this.inputCodeNull = true
} else {
this.inputCodeContent = this.inputCodeContent.toLowerCase()
this.inputCodeNull = false
}
if (this.verifiedCode == this.inputCodeContent) {
this.form.validateFields(['username'], {force: true}, (err, values) => {
if (!err&&this.countdown==0) {
clearInterval(this.timer); clearInterval(this.timer);
this.codeMsg = "获取验证码"; this.codeMsg = "获取验证码";
this.countdown = 0; this.countdown = 60;
this.timer = null; this.timer = null;
this.formLogin.username=values.username
this.getCode()
} }
} this.loginBtn=true
}, 1000)
}
},
appendData(data) {
this.single = data.single;
this.commitment = data.commitment;
},
commitmentSubmit(){
if(!this.flag){
this.countNum = 0;
}
this.commitment = true;
this.flag = true;
this.$refs.commitment.setTimer();
},
handleSubmit() {
if(!this.flag){
this.commitmentSubmit();
return;
}
let that = this
let loginParams = {
smsCode: "xxxx"
};
// 使用账户密码登陆
that.form.validateFields(['username', 'password', 'inputCode',"phonecode"], {force: true}, (err, values) => {
if (!err) {
loginParams.username = values.username;
loginParams.password = encodeURIComponent(this.getPass(values.password));
loginParams.remember = that.formLogin.remember;
loginParams.phonecode=encodeURIComponent(this.getPass(values.phonecode));
//console.log(loginParams);
that.Login(loginParams).then((res) => {
this.updateTime = res.updateTime
// console.log(res.updateTime)
this.departConfirm({});
}).catch((err) => {
that.requestFailed(err);
}) })
} }
}) },
}, departConfirm() {
//密码加密 this.loginSuccess()
getPass(text){ },
/*let keyss = setMaxDigits(130); getRouterData() {
keyss = new RSAKeyPair("10001","","a5d210338760bdbe2baabef73c410582e812dad8d9669d8c6ebfe026450e5cc10005290f17a0474c7351031edbff81bd8217a518bdf1a02855f53105ead0370e8a9e30b8560feab1d333a0b055b29419476b0eea1ea54315662ddfc46ec066f076e9490ec34c825afad9e44cf38e5ab600f3136acfe3a0ac0e672e2cb8e50371"); this.$nextTick(() => {
let password = encryptedString(keyss,text);*/ this.form.setFieldsValue({
let publicKey = "MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCAcsbUyeRD2lQGPEnu5LbXOL2lycUJwK/8BsoZD3b932l4JehAvOKR/YNzs6EG4gnZ7gaXLCnWbE5kB1wuUooo6bv8fSAg0W5QmM1TH8zaIImdAaN6c8mw5dUS/2VJ/2GHI54R1NJziX9VHecpf2DrHnWngETsNytmXaVl3JiXywIDAQAB"; 'username': this.$route.params.username
let encrypt = new window.JSEncrypt(); });
encrypt.setPublicKey(publicKey);
var encryptPwd = encrypt.encryptLong(text);
return encryptPwd;
//return text;
},
stepCaptchaSuccess() {
this.loginSuccess()
},
stepCaptchaCancel() {
this.Logout().then(() => {
this.loginBtn = false
this.stepCaptchaVisible = false
})
},
loginSuccess() {
this.loginBtn = false
this.$router.push({name: "dashboard"})
this.$notification.success({
message: '欢迎',
description: `${timeFix()},欢迎回来`,
});
},
cmsFailed(err) {
this.$notification['error']({
message: "登录失败",
description: err,
duration: 4,
});
},
requestFailed(err) {
this.$notification['error']({
message: '登录失败',
description: ((err.response || {}).data || {}).message || err.message || "请求出现错误,请稍后再试",
duration: 4,
});
// this.loginBtn = false;
},
validateMobile(rule, value, callback) {
if (!value || new RegExp(/^1([38][0-9]|4[579]|5[0-3,5-9]|6[6]|7[0135678]|9[89])\d{8}$/).test(value)) {
callback();
} else {
callback("您的手机号码格式不正确!");
}
},
validateInputCode(rule, value, callback) {
if (!value || this.verifiedCode == this.inputCodeContent) {
callback();
} else {
this.loginBtn=false
callback("您输入的验证码不正确!");
}
},
validatephoneCode(rule, value, callback){
callback();
},
generateCode(value) {
this.loginBtn=false;
this.verifiedCode = value.toLowerCase()
},
inputCodeChange(e) {
this.inputCodeContent = e.target.value
if (!e.target.value || 0 == e.target.value) {
this.inputCodeNull = true
} else {
this.inputCodeContent = this.inputCodeContent.toLowerCase()
this.inputCodeNull = false
}
if (this.verifiedCode == this.inputCodeContent) {
this.form.validateFields(['username'], {force: true}, (err, values) => {
if (!err&&this.countdown==0) {
clearInterval(this.timer);
this.codeMsg = "获取验证码";
this.countdown = 60;
this.timer = null;
this.formLogin.username=values.username
this.getCode()
}
this.loginBtn=true
}) })
} },
}, }
departConfirm() {
this.loginSuccess()
},
getRouterData() {
this.$nextTick(() => {
this.form.setFieldsValue({
'username': this.$route.params.username
});
})
},
} }
}
</script> </script>
<style lang="less" scoped> <style lang="less" scoped>
......
...@@ -102,7 +102,7 @@ import JGraphicCode from '@/components/jeecg/JGraphicCode' ...@@ -102,7 +102,7 @@ import JGraphicCode from '@/components/jeecg/JGraphicCode'
import { import {
register,registercode register,registercode
} from '@/api/system' } from '@/api/system'
import AES from "@/api/AES.js";
export default { export default {
components: { components: {
TwoStepCaptcha, TwoStepCaptcha,
...@@ -282,12 +282,17 @@ export default { ...@@ -282,12 +282,17 @@ export default {
/*let keyss = setMaxDigits(130); /*let keyss = setMaxDigits(130);
keyss = new RSAKeyPair("10001","","a5d210338760bdbe2baabef73c410582e812dad8d9669d8c6ebfe026450e5cc10005290f17a0474c7351031edbff81bd8217a518bdf1a02855f53105ead0370e8a9e30b8560feab1d333a0b055b29419476b0eea1ea54315662ddfc46ec066f076e9490ec34c825afad9e44cf38e5ab600f3136acfe3a0ac0e672e2cb8e50371"); keyss = new RSAKeyPair("10001","","a5d210338760bdbe2baabef73c410582e812dad8d9669d8c6ebfe026450e5cc10005290f17a0474c7351031edbff81bd8217a518bdf1a02855f53105ead0370e8a9e30b8560feab1d333a0b055b29419476b0eea1ea54315662ddfc46ec066f076e9490ec34c825afad9e44cf38e5ab600f3136acfe3a0ac0e672e2cb8e50371");
let password = encryptedString(keyss,text);*/ let password = encryptedString(keyss,text);*/
let publicKey = "MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCAcsbUyeRD2lQGPEnu5LbXOL2lycUJwK/8BsoZD3b932l4JehAvOKR/YNzs6EG4gnZ7gaXLCnWbE5kB1wuUooo6bv8fSAg0W5QmM1TH8zaIImdAaN6c8mw5dUS/2VJ/2GHI54R1NJziX9VHecpf2DrHnWngETsNytmXaVl3JiXywIDAQAB"; // let publicKey = "MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCAcsbUyeRD2lQGPEnu5LbXOL2lycUJwK/8BsoZD3b932l4JehAvOKR/YNzs6EG4gnZ7gaXLCnWbE5kB1wuUooo6bv8fSAg0W5QmM1TH8zaIImdAaN6c8mw5dUS/2VJ/2GHI54R1NJziX9VHecpf2DrHnWngETsNytmXaVl3JiXywIDAQAB";
let encrypt = new window.JSEncrypt(); // let encrypt = new window.JSEncrypt();
encrypt.setPublicKey(publicKey); // encrypt.setPublicKey(publicKey);
var encryptPwd = encrypt.encryptLong(text); // var encryptPwd = encrypt.encryptLong(text);
return encryptPwd; // return encryptPwd;
//return text; //return text;
let publicKey = "MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCAcsbUyeRD2lQGPEnu5LbXOL2lycUJwK/8BsoZD3b932l4JehAvOKR/YNzs6EG4gnZ7gaXLCnWbE5kB1wuUooo6bv8fSAg0W5QmM1TH8zaIImdAaN6c8mw5dUS/2VJ/2GHI54R1NJziX9VHecpf2DrHnWngETsNytmXaVl3JiXywIDAQAB";
var encrypts = AES.encrypt(text,publicKey);
return encrypts;
// var dess = AES.decrypt(encrypts);解密
} }
} }
} }
......
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