Browse Source

loginWork登陆密码加密

preview
jianjun 5 years ago
parent
commit
a160daed21
  1. 1
      epmet-oper-web/package.json
  2. 38
      epmet-oper-web/src/views/pages/loginWork.vue

1
epmet-oper-web/package.json

@ -25,6 +25,7 @@
"gulp-rename": "^1.4.0",
"gulp-sass": "^4.0.2",
"js-cookie": "^2.2.0",
"jsencrypt": "^3.0.3",
"lodash": "^4.17.15",
"node-sass": "^4.12.0",
"portfinder": "^1.0.21",

38
epmet-oper-web/src/views/pages/loginWork.vue

@ -142,11 +142,13 @@ import debounce from 'lodash/debounce'
import { messages } from '@/i18n'
import { getUUID } from '@/utils'
import { Loading } from 'element-ui' // Loading
import JSEncrypt from 'jsencrypt'//
let loading //
export default {
data () {
return {
pubKey: null, //
isShowLogin: true,
i18nMessages: messages,
captchaPath: '',
@ -191,11 +193,24 @@ export default {
this.getAutoLogin(this.$route.query.platformToken)
}else{
this.getCaptcha()
localStorage.remove('showHeader')
//
this.getPubKey()
}
},
methods: {
//
getPubKey() {
this.$http.post('/auth/govweb/getKey').then(({data: res}) => {
if (res.code !== 0) {
return this.$message.error(res.msg)
}
this.pubKey = res.data; // ;
console.log("pubkey", this.pubKey);
}).catch(() => {
})
},
//
getCaptcha () {
this.dataForm.uuid = getUUID()
@ -236,7 +251,6 @@ export default {
})
})
},
//
@ -255,7 +269,8 @@ export default {
localStorage.setItem('showHeader', '0')
Cookies.set('token', res.data.token)
this.$router.replace({name: 'home'})
}).catch(() => { })
}).catch(() => {
})
// epmet-ext9.elinkservice.cn/platform-admin
},
//
@ -267,6 +282,9 @@ export default {
const url = '/auth/govweb/login'
this.dataForm.customerId = row.customerId
console.log('password pre', this.dataForm.password);
this.dataForm.password = this.encryptedData(this.pubKey, this.dataForm.password);
console.log('password after', this.dataForm.password);
this.$http.post(url, this.dataForm).then(({data: res}) => {
if (res.code !== 0) {
this.getCaptcha()
@ -278,7 +296,8 @@ export default {
Cookies.set('token', res.data.token)
this.$router.replace({name: 'home'})
}).catch(() => { })
}).catch(() => {
})
this.endLoading()
},
@ -301,8 +320,17 @@ export default {
if (loading) {
loading.close()
}
},
//
encryptedData(key, data) {
debugger
// JSEncrypt
let encryptor = new JSEncrypt();
//
encryptor.setPublicKey(key);
//
return encryptor.encrypt(data);
}
}
}

Loading…
Cancel
Save