Skip to content

Commit a93011a

Browse files
committed
get rid of password popups
1 parent 80e8609 commit a93011a

File tree

2 files changed

+38
-25
lines changed

2 files changed

+38
-25
lines changed

ui/src/components/Devices.vue

+22-16
Original file line numberDiff line numberDiff line change
@@ -113,10 +113,11 @@
113113
persistent-hint :readonly="!inEdit" />
114114
<v-text-field v-model="selected.device.id" label="Device ID" readonly />
115115
<v-text-field v-model="selected.device.server" label="Server" :readonly="!inEdit" />
116-
<v-text-field v-model="selected.device.apiKey" label="API Key" readonly
117-
:append-icon="showApiKey ? 'mdi-eye' : 'mdi-eye-off'"
118-
:type="showApiKey ? 'text' : 'password'"
119-
@click:append="showApiKey = !showApiKey" />
116+
117+
<v-text-field v-if="!inEdit" label="API Key" readonly
118+
append-icon="mdi-content-copy" @click:append="copy(selected.device.apiKey)">* * * *</v-text-field>
119+
<v-text-field v-if="inEdit" v-model="selected.device.apiKey" label="API Key" />
120+
120121
<v-text-field v-model="selected.device.instanceid" label="AWS or Azure Instance ID" :readonly="!inEdit" />
121122
<div :hidden="!inEdit">
122123
<v-text-field v-model="selected.device.name" label="Device friendly name"
@@ -240,17 +241,11 @@
240241
label="Role" single dark />
241242
<v-text-field v-model="selected.vpn.current.table" label="Table" />
242243
<v-text-field v-model="selected.vpn.current.publicKey" label="Public key" />
243-
<v-text-field v-model="selected.vpn.current.privateKey" label="Private key"
244-
autocomplete="off"
245-
:append-icon="showPrivate ? 'mdi-eye' : 'mdi-eye-off'"
246-
:type="showPrivate ? 'text' : 'password'"
247-
hint="Clear this field to have the client manage its private key"
248-
@click:append="showPrivate = !showPrivate" />
249-
<v-text-field v-model="selected.vpn.current.presharedKey"
250-
label="Preshared Key" autocomplete="off"
251-
:append-icon="showPreshared ? 'mdi-eye' : 'mdi-eye-off'"
252-
:type="showPreshared ? 'text' : 'password'"
253-
@click:append="showPreshared = !showPreshared" />
244+
<v-text-field v-if="!editPrivate" label="Private key" readonly append-icon="mdi-square-edit-outline" @click:append="editPrivate = true" />
245+
<v-text-field v-if="editPrivate" v-model="selected.vpn.current.privateKey" label="Private key"
246+
hint="Clear this field to have the client manage its private key" />
247+
<v-text-field label="Preshared Key" readonly
248+
append-icon="mdi-content-copy" @click:append="copy(selected.vpn.current.presharedKey)" />
254249
<v-text-field type="number"
255250
v-model="selected.vpn.current.persistentKeepalive"
256251
label="Persistent keepalive"
@@ -551,6 +546,7 @@ export default {
551546
showApiKey: false,
552547
showTree: false,
553548
friendly: false,
549+
editPrivate: false,
554550
use_ezcode: true,
555551
footerProps: { 'items-per-page-options': [25, 50, 100, -1] },
556552
dialogCreate: false,
@@ -1049,6 +1045,7 @@ export default {
10491045
//}
10501046
vpn = this.vpn
10511047
this.inEdit = false;
1048+
this.editPrivate = false;
10521049
this.updatevpn(this.vpn)
10531050
// this.updatedevice_vpn(this.vpn)
10541051
// this.Refreshing()
@@ -1128,7 +1125,7 @@ export default {
11281125
this.addNet.items[i+1] = { "text": this.nets[i].netName, "value": this.nets[i] }
11291126
}
11301127
},
1131-
1128+
11321129
copyDeviceConfig(device) {
11331130
var url = "curl \"http://localhost:53280/config/?id=" + device.id + "&apiKey=" + device.apiKey + "&server=" + device.server + "\""
11341131
@@ -1166,6 +1163,15 @@ export default {
11661163
this.Refreshing()
11671164
},
11681165
1166+
copy(text) {
1167+
navigator.clipboard
1168+
.writeText(text)
1169+
.then(() => {
1170+
this.errorDevice("Copied to clipboard")
1171+
})
1172+
},
1173+
1174+
11691175
async forceFileDownload(vpn) {
11701176
console.log(vpn)
11711177
await this.readvpnconfig(vpn)

ui/src/components/Network.vue

+16-9
Original file line numberDiff line numberDiff line change
@@ -295,15 +295,11 @@
295295
label="Role" single dark />
296296
<v-text-field v-model="selected.vpn.current.table" label="Table" />
297297
<v-text-field v-model="selected.vpn.current.publicKey" label="Public key" />
298-
<v-text-field v-model="selected.vpn.current.privateKey" label="Private key"
299-
autocomplete="off" :append-icon="showPrivate ? 'mdi-eye' : 'mdi-eye-off'"
300-
:type="showPrivate ? 'text' : 'password'"
301-
hint="Clear this field to have the client manage its private key"
302-
@click:append="showPrivate = !showPrivate" />
303-
<v-text-field v-model="selected.vpn.current.presharedKey" label="Preshared Key"
304-
autocomplete="off" :append-icon="showPreshared ? 'mdi-eye' : 'mdi-eye-off'"
305-
:type="showPreshared ? 'text' : 'password'"
306-
@click:append="showPreshared = !showPreshared" />
298+
<v-text-field v-if="!editPrivate" label="Private key" readonly append-icon="mdi-square-edit-outline" @click:append="editPrivate = true" />
299+
<v-text-field v-if="editPrivate" v-model="selected.vpn.current.privateKey" label="Private key"
300+
hint="Clear this field to have the client manage its private key" />
301+
<v-text-field label="Preshared Key" readonly
302+
append-icon="mdi-content-copy" @click:append="copy(selected.vpn.current.presharedKey)" />
307303
<v-text-field type="number" v-model="selected.vpn.current.persistentKeepalive"
308304
label="Persistent keepalive"
309305
hint="To disable, set to 0. Recommended value 29 (seconds)" />
@@ -549,6 +545,7 @@ export default {
549545
deviceList: {},
550546
isOwner: false,
551547
inEdit: false,
548+
editPrivate: false,
552549
dialogCreate: false,
553550
dialogAddDevice: false,
554551
publicSubnets: false,
@@ -1121,6 +1118,7 @@ export default {
11211118

11221119

11231120
this.inEdit = false;
1121+
this.editPrivate = false;
11241122
this.updatevpn(this.vpn)
11251123
},
11261124

@@ -1132,6 +1130,15 @@ export default {
11321130
}
11331131
},
11341132

1133+
copy(text) {
1134+
navigator.clipboard
1135+
.writeText(text)
1136+
.then(() => {
1137+
this.errorNet("Copied to clipboard")
1138+
})
1139+
},
1140+
1141+
11351142
async forceFileDownload(vpn) {
11361143
console.log("vpn = ", vpn)
11371144

0 commit comments

Comments
 (0)