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-rename": "^1.4.0",
"gulp-sass": "^4.0.2", "gulp-sass": "^4.0.2",
"js-cookie": "^2.2.0", "js-cookie": "^2.2.0",
"jsencrypt": "^3.0.3",
"lodash": "^4.17.15", "lodash": "^4.17.15",
"node-sass": "^4.12.0", "node-sass": "^4.12.0",
"portfinder": "^1.0.21", "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 { messages } from '@/i18n'
import { getUUID } from '@/utils' import { getUUID } from '@/utils'
import { Loading } from 'element-ui' // Loading import { Loading } from 'element-ui' // Loading
import JSEncrypt from 'jsencrypt'//
let loading // let loading //
export default { export default {
data () { data () {
return { return {
pubKey: null, //
isShowLogin: true, isShowLogin: true,
i18nMessages: messages, i18nMessages: messages,
captchaPath: '', captchaPath: '',
@ -191,11 +193,24 @@ export default {
this.getAutoLogin(this.$route.query.platformToken) this.getAutoLogin(this.$route.query.platformToken)
}else{ }else{
this.getCaptcha() this.getCaptcha()
localStorage.remove('showHeader') //
this.getPubKey()
} }
}, },
methods: { 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 () { getCaptcha () {
this.dataForm.uuid = getUUID() this.dataForm.uuid = getUUID()
@ -236,7 +251,6 @@ export default {
}) })
}) })
}, },
// //
@ -255,7 +269,8 @@ export default {
localStorage.setItem('showHeader', '0') localStorage.setItem('showHeader', '0')
Cookies.set('token', res.data.token) Cookies.set('token', res.data.token)
this.$router.replace({name: 'home'}) this.$router.replace({name: 'home'})
}).catch(() => { }) }).catch(() => {
})
// epmet-ext9.elinkservice.cn/platform-admin // epmet-ext9.elinkservice.cn/platform-admin
}, },
// //
@ -267,6 +282,9 @@ export default {
const url = '/auth/govweb/login' const url = '/auth/govweb/login'
this.dataForm.customerId = row.customerId 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}) => { this.$http.post(url, this.dataForm).then(({data: res}) => {
if (res.code !== 0) { if (res.code !== 0) {
this.getCaptcha() this.getCaptcha()
@ -278,7 +296,8 @@ export default {
Cookies.set('token', res.data.token) Cookies.set('token', res.data.token)
this.$router.replace({name: 'home'}) this.$router.replace({name: 'home'})
}).catch(() => { }) }).catch(() => {
})
this.endLoading() this.endLoading()
}, },
@ -301,8 +320,17 @@ export default {
if (loading) { if (loading) {
loading.close() loading.close()
} }
},
//
encryptedData(key, data) {
debugger
// JSEncrypt
let encryptor = new JSEncrypt();
//
encryptor.setPublicKey(key);
//
return encryptor.encrypt(data);
} }
} }
} }

Loading…
Cancel
Save