1
0
mirror of https://github.com/donaldzou/WGDashboard.git synced 2024-11-22 07:10:09 +01:00

Update presharedKeyInput.vue

Added preshared key switch
This commit is contained in:
Donald Zou 2024-09-05 16:43:46 +08:00
parent 809651054e
commit bcc983f11f

View File

@ -4,17 +4,38 @@ export default {
props: { props: {
data: Object, data: Object,
saving: Boolean saving: Boolean
},
data(){
return{
enable: false
}
},
watch:{
enable(){
if (this.enable){
this.data.preshared_key = window.wireguard.generateKeypair().presharedKey
}else {
this.data.preshared_key = ""
}
}
} }
} }
</script> </script>
<template> <template>
<div> <div>
<label for="peer_preshared_key_textbox" class="form-label"> <div class="d-flex align-items-start">
<small class="text-muted">Pre-Shared Key</small> <label for="peer_preshared_key_textbox" class="form-label">
</label> <small class="text-muted">Pre-Shared Key</small>
</label>
<div class="form-check form-switch ms-auto">
<input class="form-check-input" type="checkbox" role="switch"
v-model="this.enable"
id="peer_preshared_key_switch">
</div>
</div>
<input type="text" class="form-control form-control-sm rounded-3" <input type="text" class="form-control form-control-sm rounded-3"
:disabled="this.saving" :disabled="this.saving || !this.enable"
v-model="this.data.preshared_key" v-model="this.data.preshared_key"
id="peer_preshared_key_textbox"> id="peer_preshared_key_textbox">
</div> </div>