|
|
@@ -65,7 +65,8 @@ export default {
|
|
|
password: '',
|
|
|
captcha: '',
|
|
|
rememberMe: false,
|
|
|
- pubkey: ''
|
|
|
+ pubkey: '',
|
|
|
+ pubkeyR: ''
|
|
|
}
|
|
|
},
|
|
|
created() {
|
|
|
@@ -73,15 +74,14 @@ export default {
|
|
|
this.fetchPubkey()
|
|
|
},
|
|
|
methods: {
|
|
|
- encryptPassword(password) {
|
|
|
+ encryptPassword(password, pubkey, pubkeyR) {
|
|
|
var encryptor = new JSEncrypt()
|
|
|
- encryptor.setPublicKey(this.pubkey)
|
|
|
- const r = encryptor.encrypt(password)
|
|
|
- console.log(r)
|
|
|
+ encryptor.setPublicKey(pubkey)
|
|
|
+ return encryptor.encrypt(pubkeyR + password)
|
|
|
},
|
|
|
submitLogin() {
|
|
|
const username = this.username
|
|
|
- const password = this.$options.methods.encryptPassword(this.password)
|
|
|
+ const password = this.$options.methods.encryptPassword(this.password, this.pubkey, this.pubkeyR)
|
|
|
// const password = this.password
|
|
|
const captcha = this.captcha
|
|
|
const r = this.r
|
|
|
@@ -116,7 +116,8 @@ export default {
|
|
|
fetchPubkey() {
|
|
|
getPubkey().then(res => {
|
|
|
if (res.code === 0) {
|
|
|
- this.pubkey = res.data
|
|
|
+ this.pubkey = res.data.pubkey
|
|
|
+ this.pubkeyR = res.data.r
|
|
|
} else {
|
|
|
alert(res.data)
|
|
|
}
|