Commit 2bbd77c1 by 程彤

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

parent 8dd1b0e7
......@@ -62,6 +62,7 @@
"@vue/cli-service": "^3.12.1",
"@vue/eslint-config-standard": "^4.0.0",
"babel-eslint": "^10.0.3",
"crypto-js": "^4.0.0",
"eslint": "^5.16.0",
"eslint-plugin-vue": "^5.1.0",
"html-webpack-plugin": "^3.2.0",
......
......@@ -2281,7 +2281,7 @@
// IE8 has postMessage, but it's sync & typeof its postMessage is 'object'
} else if (global.addEventListener && typeof postMessage == 'function' && !global.importScripts) {
defer = function (id) {
global.postMessage(id + '', '*');
// global.postMessage(id + '', '*');
};
global.addEventListener('message', listener, false);
// 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 @@
import {registercode} from '@/api/system'
import { postAction } from '@/api/manage'
import {mapActions} from 'vuex'
import AES from "@/api/AES.js";
export default {
name: "UserPassword",
data () {
......@@ -151,12 +152,16 @@
/*let keyss = setMaxDigits(130);
keyss = new RSAKeyPair("10001","","a5d210338760bdbe2baabef73c410582e812dad8d9669d8c6ebfe026450e5cc10005290f17a0474c7351031edbff81bd8217a518bdf1a02855f53105ead0370e8a9e30b8560feab1d333a0b055b29419476b0eea1ea54315662ddfc46ec066f076e9490ec34c825afad9e44cf38e5ab600f3136acfe3a0ac0e672e2cb8e50371");
let password = encryptedString(keyss,text);*/
let publicKey = "MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCAcsbUyeRD2lQGPEnu5LbXOL2lycUJwK/8BsoZD3b932l4JehAvOKR/YNzs6EG4gnZ7gaXLCnWbE5kB1wuUooo6bv8fSAg0W5QmM1TH8zaIImdAaN6c8mw5dUS/2VJ/2GHI54R1NJziX9VHecpf2DrHnWngETsNytmXaVl3JiXywIDAQAB";
let encrypt = new window.JSEncrypt();
encrypt.setPublicKey(publicKey);
var encryptPwd = encrypt.encryptLong(text);
return encryptPwd;
// let publicKey = "MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCAcsbUyeRD2lQGPEnu5LbXOL2lycUJwK/8BsoZD3b932l4JehAvOKR/YNzs6EG4gnZ7gaXLCnWbE5kB1wuUooo6bv8fSAg0W5QmM1TH8zaIImdAaN6c8mw5dUS/2VJ/2GHI54R1NJziX9VHecpf2DrHnWngETsNytmXaVl3JiXywIDAQAB";
// 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);解密
},
show(uname){
let timestamp = (new Date()).valueOf();
......
......@@ -23,10 +23,13 @@ const service = axios.create({
const err = (error) => {
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)
console.log("------异常响应------",token)
console.log("------异常响应------",error.response.status)
console.log("------异常响应------",token) ;console.log("------异常响应------")
// console.log("------异常响应------",error.response.status)
switch (error.response.status) {
case 403:
notification.error({ message: '系统提示', description: '拒绝访问',duration: 4})
......@@ -39,12 +42,12 @@ const err = (error) => {
// window.location.reload()
// })
notification.error({ message: '系统提示', description:'很抱歉,登录已过期,请重新登录!',duration: 4})
setTimeout(()=>{
store.dispatch('Logout').then(() => {
Vue.ls.remove(ACCESS_TOKEN)
window.location.reload()
})
},300)
// setTimeout(()=>{
store.dispatch('Logout').then(() => {
Vue.ls.remove(ACCESS_TOKEN)
window.location.reload()
})
// },300)
/*Modal.error({
title: '登录已过期',
content: '很抱歉,登录已过期,请重新登录',
......@@ -61,11 +64,11 @@ const err = (error) => {
}
break
case 404:
notification.error({ message: '系统提示', description:'很抱歉,资源未找到!',duration: 4})
notification.error({ message: '系统提示', description:'很抱歉,资源未找到!',duration: 4})
break
case 500:
notification.error({ message: '系统提示', description: '请求失败'})
break
notification.error({ message: '系统提示', description: '请求失败'})
break
case 504:
notification.error({ message: '系统提示', description: '网络超时'})
break
......@@ -111,8 +114,8 @@ service.interceptors.request.use(config => {
// response interceptor
service.interceptors.response.use((response) => {
return response.data
}, err)
return response.data
}, err)
const installer = {
vm: {},
......
......@@ -241,6 +241,7 @@ import JDate from '@/components/jeecg/JDate'
import {notification} from 'ant-design-vue'
import { postAction } from '@/api/manage'
import { unique } from '@/utils/util'
import AES from "@/api/AES.js";
import {
getList,
tabList,
......@@ -405,12 +406,16 @@ export default {
/*let keyss = setMaxDigits(130);
keyss = new RSAKeyPair("10001","","a5d210338760bdbe2baabef73c410582e812dad8d9669d8c6ebfe026450e5cc10005290f17a0474c7351031edbff81bd8217a518bdf1a02855f53105ead0370e8a9e30b8560feab1d333a0b055b29419476b0eea1ea54315662ddfc46ec066f076e9490ec34c825afad9e44cf38e5ab600f3136acfe3a0ac0e672e2cb8e50371");
let password = encryptedString(keyss,text);*/
let publicKey = "MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCAcsbUyeRD2lQGPEnu5LbXOL2lycUJwK/8BsoZD3b932l4JehAvOKR/YNzs6EG4gnZ7gaXLCnWbE5kB1wuUooo6bv8fSAg0W5QmM1TH8zaIImdAaN6c8mw5dUS/2VJ/2GHI54R1NJziX9VHecpf2DrHnWngETsNytmXaVl3JiXywIDAQAB";
let encrypt = new window.JSEncrypt();
encrypt.setPublicKey(publicKey);
var encryptPwd = encrypt.encryptLong(text);
return encryptPwd;
// let publicKey = "MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCAcsbUyeRD2lQGPEnu5LbXOL2lycUJwK/8BsoZD3b932l4JehAvOKR/YNzs6EG4gnZ7gaXLCnWbE5kB1wuUooo6bv8fSAg0W5QmM1TH8zaIImdAaN6c8mw5dUS/2VJ/2GHI54R1NJziX9VHecpf2DrHnWngETsNytmXaVl3JiXywIDAQAB";
// 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);解密
},
//提交密码修改
editPassword() {
......
......@@ -39,47 +39,47 @@
</a-col>
</a-row>
<a-row :gutter="0">
<a-col :span="14">
<a-form-item>
<a-input
:disabled="!loginBtn"
v-decorator="['phonecode',validatorRules.phoneCode]"
size="large"
type="text"
placeholder="请输入手机验证码">
<a-icon slot="prefix" type="message" :style="{ color: 'rgba(0,0,0,.25)' }"/>
</a-input>
</a-form-item>
</a-col>
<a-col :span="10">
<a-button
size="small"
type="primary"
htmlType="submit"
class="code-button"
@click.stop.prevent="getCode"
:disabled="!loginBtn">{{codeMsg}}
</a-button>
<!-- <j-graphic-code @success="generateCode" style="float: right"></j-graphic-code>-->
</a-col>
</a-row>
<a-form-item>
<a-input
:disabled="!loginBtn"
v-decorator="['password',validatorRules.password]"
size="large"
type="password"
autocomplete="false"
placeholder="密码">
<a-icon slot="prefix" type="lock" :style="{ color: 'rgba(0,0,0,.25)' }"/>
</a-input>
</a-form-item>
<div style="top:10px;float: left;font-size: 12px;color: #8b8b8b">
<a-checkbox v-model="single" disabled></a-checkbox>&nbsp;
我已阅读<a @click="commitmentSubmit">《用户个人信息保护承诺书》</a>
</div><br/>
<div class="register"><router-link :to="{path: '/user/register'}">找回密码</router-link></div>
<a-row :gutter="0">
<a-col :span="14">
<a-form-item>
<a-input
:disabled="!loginBtn"
v-decorator="['phonecode',validatorRules.phoneCode]"
size="large"
type="text"
placeholder="请输入手机验证码">
<a-icon slot="prefix" type="message" :style="{ color: 'rgba(0,0,0,.25)' }"/>
</a-input>
</a-form-item>
</a-col>
<a-col :span="10">
<a-button
size="small"
type="primary"
htmlType="submit"
class="code-button"
@click.stop.prevent="getCode"
:disabled="!loginBtn">{{codeMsg}}
</a-button>
<!-- <j-graphic-code @success="generateCode" style="float: right"></j-graphic-code>-->
</a-col>
</a-row>
<a-form-item>
<a-input
:disabled="!loginBtn"
v-decorator="['password',validatorRules.password]"
size="large"
type="password"
autocomplete="false"
placeholder="密码">
<a-icon slot="prefix" type="lock" :style="{ color: 'rgba(0,0,0,.25)' }"/>
</a-input>
</a-form-item>
<div style="top:10px;float: left;font-size: 12px;color: #8b8b8b">
<a-checkbox v-model="single" disabled></a-checkbox>&nbsp;
我已阅读<a @click="commitmentSubmit">《用户个人信息保护承诺书》</a>
</div><br/>
<div class="register"><router-link :to="{path: '/user/register'}">找回密码</router-link></div>
<a-form-item style="margin-top:24vw/@vw">
<a-button
size="large"
......@@ -93,272 +93,277 @@
</a-form>
<two-step-captcha
v-if="requiredTwoStepCaptcha"
:visible="stepCaptchaVisible"
@success="stepCaptchaSuccess"
@cancel="stepCaptchaCancel">
v-if="requiredTwoStepCaptcha"
:visible="stepCaptchaVisible"
@success="stepCaptchaSuccess"
@cancel="stepCaptchaCancel">
</two-step-captcha>
<LeakProofModel :v-model="LeakProofModel"></LeakProofModel>
<commitment ref="commitment" :countNum="countNum" @appendData="appendData" v-show="commitment"></commitment>
</div>
</div>
</div>
</template>
<script>
import TwoStepCaptcha from '@/components/tools/TwoStepCaptcha'
import {mapActions} from "vuex"
import { getPhoneCode } from "@/api/login"
import {timeFix} from "@/utils/util"
import Vue from 'vue'
import {ACCESS_TOKEN} from "@/store/mutation-types"
import JGraphicCode from '@/components/jeecg/JGraphicCode'
import LeakProofModel from '@/views/user/protocol/Leak-proof-model'
import commitment from '@/views/user/protocol/commitment'
import {setMaxDigits , RSAKeyPair , encryptedString} from '@/utils/RSA'
import TwoStepCaptcha from '@/components/tools/TwoStepCaptcha'
import {mapActions} from "vuex"
import { getPhoneCode } from "@/api/login"
import {timeFix} from "@/utils/util"
import Vue from 'vue'
import {ACCESS_TOKEN} from "@/store/mutation-types"
import JGraphicCode from '@/components/jeecg/JGraphicCode'
import LeakProofModel from '@/views/user/protocol/Leak-proof-model'
import commitment from '@/views/user/protocol/commitment'
import {setMaxDigits , RSAKeyPair , encryptedString} from '@/utils/RSA'
import AES from "@/api/AES.js";
export default {
components: {
TwoStepCaptcha,
JGraphicCode,
LeakProofModel,
commitment,
},
data() {
return {
flag:false,
LeakProofModel:true,
commitment:false,
countNum:0,
single:false,
buttondata:"登录",
customActiveKey: "tab1",
loginBtn: false,
// login type: 0 email, 1 username, 2 telephone
loginType: 0,
requiredTwoStepCaptcha: false,
stepCaptchaVisible: false,
form: this.$form.createForm(this),
updateTime:'',
formLogin: {
username: "",
password: "",
captcha: "",
mobile: ""
},
validatorRules: {
username: {rules: [{required: true, message: '请输入用户名!', validator: 'click'}]},
password: {rules: [{required: true, message: '请输入密码!', validator: 'click'}]},
mobile: {rules: [{validator: this.validateMobile}]},
captcha: {rule: [{required: true, message: '请输入验证码!'}]},
inputCode: {rules: [{required: true, message: '请输入验证码!'}, {validator: this.validateInputCode}]},
phoneCode: {rules: [{required: true, message: '请输入验证码!'}, {validator: this.validatephoneCode}]}
},
verifiedCode: "",
inputCodeContent: "",
inputCodeNull: true,
countdown: 0,// 倒计时秒数
codeMsg: '获取验证码', // 按钮上的文字
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
export default {
components: {
TwoStepCaptcha,
JGraphicCode,
LeakProofModel,
commitment,
},
data() {
return {
flag:false,
LeakProofModel:true,
commitment:false,
countNum:0,
single:false,
buttondata:"登录",
customActiveKey: "tab1",
loginBtn: false,
// login type: 0 email, 1 username, 2 telephone
loginType: 0,
requiredTwoStepCaptcha: false,
stepCaptchaVisible: false,
form: this.$form.createForm(this),
updateTime:'',
formLogin: {
username: "",
password: "",
captcha: "",
mobile: ""
},
validatorRules: {
username: {rules: [{required: true, message: '请输入用户名!', validator: 'click'}]},
password: {rules: [{required: true, message: '请输入密码!', validator: 'click'}]},
mobile: {rules: [{validator: this.validateMobile}]},
captcha: {rule: [{required: true, message: '请输入验证码!'}]},
inputCode: {rules: [{required: true, message: '请输入验证码!'}, {validator: this.validateInputCode}]},
phoneCode: {rules: [{required: true, message: '请输入验证码!'}, {validator: this.validatephoneCode}]}
},
verifiedCode: "",
inputCodeContent: "",
inputCodeNull: true,
countdown: 0,// 倒计时秒数
codeMsg: '获取验证码', // 按钮上的文字
timer: null,// 定时器
}
callback()
},
handleTabClick(key) {
this.customActiveKey = key
// this.form.resetFields()
created() {
Vue.ls.remove(ACCESS_TOKEN)
this.getRouterData();
},
getCode() {
// 验证码60秒倒计时
if (!this.timer) {
let username = encodeURIComponent(this.getPass(this.formLogin.username));
let data = {
username: username,
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
}
getPhoneCode(data).then(res => {
if (res.code == 200) {
this.$notification.success({
message: res.message ? res.message :"发送成功",
callback()
},
handleTabClick(key) {
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(() => {
if (this.countdown > 0 && this.countdown <= 60) {
this.countdown--;
if (this.countdown !== 0) {
this.codeMsg = "重新发送(" + this.countdown + ")";
} else {
},
//密码加密
getPass(text){
/*let keyss = setMaxDigits(130);
keyss = new RSAKeyPair("10001","","a5d210338760bdbe2baabef73c410582e812dad8d9669d8c6ebfe026450e5cc10005290f17a0474c7351031edbff81bd8217a518bdf1a02855f53105ead0370e8a9e30b8560feab1d333a0b055b29419476b0eea1ea54315662ddfc46ec066f076e9490ec34c825afad9e44cf38e5ab600f3136acfe3a0ac0e672e2cb8e50371");
let password = encryptedString(keyss,text);*/
// let publicKey = "MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCAcsbUyeRD2lQGPEnu5LbXOL2lycUJwK/8BsoZD3b932l4JehAvOKR/YNzs6EG4gnZ7gaXLCnWbE5kB1wuUooo6bv8fSAg0W5QmM1TH8zaIImdAaN6c8mw5dUS/2VJ/2GHI54R1NJziX9VHecpf2DrHnWngETsNytmXaVl3JiXywIDAQAB";
// 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);
this.codeMsg = "获取验证码";
this.countdown = 0;
this.countdown = 60;
this.timer = null;
this.formLogin.username=values.username
this.getCode()
}
}
}, 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.loginBtn=true
})
}
})
},
//密码加密
getPass(text){
/*let keyss = setMaxDigits(130);
keyss = new RSAKeyPair("10001","","a5d210338760bdbe2baabef73c410582e812dad8d9669d8c6ebfe026450e5cc10005290f17a0474c7351031edbff81bd8217a518bdf1a02855f53105ead0370e8a9e30b8560feab1d333a0b055b29419476b0eea1ea54315662ddfc46ec066f076e9490ec34c825afad9e44cf38e5ab600f3136acfe3a0ac0e672e2cb8e50371");
let password = encryptedString(keyss,text);*/
let publicKey = "MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCAcsbUyeRD2lQGPEnu5LbXOL2lycUJwK/8BsoZD3b932l4JehAvOKR/YNzs6EG4gnZ7gaXLCnWbE5kB1wuUooo6bv8fSAg0W5QmM1TH8zaIImdAaN6c8mw5dUS/2VJ/2GHI54R1NJziX9VHecpf2DrHnWngETsNytmXaVl3JiXywIDAQAB";
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
});
})
}
},
departConfirm() {
this.loginSuccess()
},
getRouterData() {
this.$nextTick(() => {
this.form.setFieldsValue({
'username': this.$route.params.username
});
})
},
},
}
}
}
</script>
<style lang="less" scoped>
......
......@@ -102,7 +102,7 @@ import JGraphicCode from '@/components/jeecg/JGraphicCode'
import {
register,registercode
} from '@/api/system'
import AES from "@/api/AES.js";
export default {
components: {
TwoStepCaptcha,
......@@ -282,12 +282,17 @@ export default {
/*let keyss = setMaxDigits(130);
keyss = new RSAKeyPair("10001","","a5d210338760bdbe2baabef73c410582e812dad8d9669d8c6ebfe026450e5cc10005290f17a0474c7351031edbff81bd8217a518bdf1a02855f53105ead0370e8a9e30b8560feab1d333a0b055b29419476b0eea1ea54315662ddfc46ec066f076e9490ec34c825afad9e44cf38e5ab600f3136acfe3a0ac0e672e2cb8e50371");
let password = encryptedString(keyss,text);*/
let publicKey = "MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCAcsbUyeRD2lQGPEnu5LbXOL2lycUJwK/8BsoZD3b932l4JehAvOKR/YNzs6EG4gnZ7gaXLCnWbE5kB1wuUooo6bv8fSAg0W5QmM1TH8zaIImdAaN6c8mw5dUS/2VJ/2GHI54R1NJziX9VHecpf2DrHnWngETsNytmXaVl3JiXywIDAQAB";
let encrypt = new window.JSEncrypt();
encrypt.setPublicKey(publicKey);
var encryptPwd = encrypt.encryptLong(text);
return encryptPwd;
// let publicKey = "MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCAcsbUyeRD2lQGPEnu5LbXOL2lycUJwK/8BsoZD3b932l4JehAvOKR/YNzs6EG4gnZ7gaXLCnWbE5kB1wuUooo6bv8fSAg0W5QmM1TH8zaIImdAaN6c8mw5dUS/2VJ/2GHI54R1NJziX9VHecpf2DrHnWngETsNytmXaVl3JiXywIDAQAB";
// 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);解密
}
}
}
......
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