mirror of
https://github.com/donaldzou/WGDashboard.git
synced 2024-11-22 15:20:09 +01:00
Merge pull request #386 from donaldzou/v4.0.3-fix
Update privatePublicKeyInput.vue
This commit is contained in:
commit
6f681dba09
@ -30,12 +30,24 @@ export default {
|
|||||||
this.data.private_key = this.keypair.privateKey;
|
this.data.private_key = this.keypair.privateKey;
|
||||||
this.data.public_key = this.keypair.publicKey;
|
this.data.public_key = this.keypair.publicKey;
|
||||||
},
|
},
|
||||||
|
testKey(key){
|
||||||
|
const reg = /^[A-Za-z0-9+/]{43}=?=?$/;
|
||||||
|
return reg.test(key)
|
||||||
|
},
|
||||||
checkMatching(){
|
checkMatching(){
|
||||||
try{
|
try{
|
||||||
if (window.wireguard.generatePublicKey(this.keypair.privateKey)
|
if(this.keypair.privateKey){
|
||||||
!== this.keypair.publicKey){
|
if(this.testKey(this.keypair.privateKey)){
|
||||||
this.error = true;
|
this.keypair.publicKey = window.wireguard.generatePublicKey(this.keypair.privateKey)
|
||||||
this.dashboardStore.newMessage("WGDashboard", "Private Key and Public Key does not match.", "danger");
|
if (window.wireguard.generatePublicKey(this.keypair.privateKey)
|
||||||
|
!== this.keypair.publicKey){
|
||||||
|
this.error = true;
|
||||||
|
this.dashboardStore.newMessage("WGDashboard", "Private Key and Public Key does not match.", "danger");
|
||||||
|
}else{
|
||||||
|
this.data.private_key = this.keypair.privateKey
|
||||||
|
this.data.public_key = this.keypair.publicKey
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}catch (e){
|
}catch (e){
|
||||||
this.error = true;
|
this.error = true;
|
||||||
|
Loading…
Reference in New Issue
Block a user