@@ -129,6 +129,26 @@ <h4 class="modal-title">Edit Client</h4>
129
129
</ label >
130
130
</ div >
131
131
</ div >
132
+ < details >
133
+ < summary > < strong > Public and Preshared Keys</ strong >
134
+ < i class ="fas fa-info-circle " data-toggle ="tooltip "
135
+ data-original-title ="Update the server stored
136
+ client Public and Preshared keys. ">
137
+ </ i >
138
+ </ summary >
139
+ < div class ="form-group " style ="margin-top: 1rem ">
140
+ < label for ="_client_public_key " class ="control-label ">
141
+ Public Key
142
+ </ label >
143
+ < input type ="text " class ="form-control " id ="_client_public_key " name ="_client_public_key " aria-invalid ="false ">
144
+ </ div >
145
+ < div class ="form-group ">
146
+ < label for ="_client_preshared_key " class ="control-label ">
147
+ Preshared Key
148
+ </ label >
149
+ < input type ="text " class ="form-control " id ="_client_preshared_key " name ="_client_preshared_key ">
150
+ </ div >
151
+ </ details >
132
152
</ div >
133
153
< div class ="modal-footer justify-content-between ">
134
154
< button type ="button " class ="btn btn-default " data-dismiss ="modal "> Cancel</ button >
@@ -388,6 +408,7 @@ <h4 class="modal-title">Remove</h4>
388
408
389
409
390
410
// Edit client modal event
411
+ // This fills the modal dialogue with data from the DB when we open the edit menu
391
412
$ ( document ) . ready ( function ( ) {
392
413
$ ( "#modal_edit_client" ) . on ( 'show.bs.modal' , function ( event ) {
393
414
let modal = $ ( this ) ;
@@ -458,6 +479,9 @@ <h4 class="modal-title">Remove</h4>
458
479
459
480
modal . find ( "#_use_server_dns" ) . prop ( "checked" , client . use_server_dns ) ;
460
481
modal . find ( "#_enabled" ) . prop ( "checked" , client . enabled ) ;
482
+
483
+ modal . find ( "#_client_public_key" ) . val ( client . public_key ) ;
484
+ modal . find ( "#_client_preshared_key" ) . val ( client . preshared_key ) ;
461
485
} ,
462
486
error : function ( jqXHR , exception ) {
463
487
const responseJson = jQuery . parseJSON ( jqXHR . responseText ) ;
@@ -523,6 +547,8 @@ <h4 class="modal-title">Remove</h4>
523
547
}
524
548
525
549
// submitEditClient function for updating an existing client
550
+ // This sends dialogue data to the back-end when user presses "Save"
551
+ // See e.g. routes.go:UpdateClient for where data is processed/verified.
526
552
function submitEditClient ( ) {
527
553
const client_id = $ ( "#_client_id" ) . val ( ) ;
528
554
const name = $ ( "#_client_name" ) . val ( ) ;
@@ -531,6 +557,8 @@ <h4 class="modal-title">Remove</h4>
531
557
const allowed_ips = $ ( "#_client_allowed_ips" ) . val ( ) . split ( "," ) ;
532
558
let use_server_dns = false ;
533
559
let extra_allowed_ips = [ ] ;
560
+ const public_key = $ ( "#_client_public_key" ) . val ( ) ;
561
+ const preshared_key = $ ( "#_client_preshared_key" ) . val ( ) ;
534
562
535
563
if ( $ ( "#_client_extra_allowed_ips" ) . val ( ) !== "" ) {
536
564
extra_allowed_ips = $ ( "#_client_extra_allowed_ips" ) . val ( ) . split ( "," ) ;
@@ -547,7 +575,7 @@ <h4 class="modal-title">Remove</h4>
547
575
}
548
576
549
577
const data = { "id" : client_id , "name" : name , "email" : email , "allocated_ips" : allocated_ips ,
550
- "allowed_ips" : allowed_ips , "extra_allowed_ips" : extra_allowed_ips , "use_server_dns" : use_server_dns , "enabled" : enabled } ;
578
+ "allowed_ips" : allowed_ips , "extra_allowed_ips" : extra_allowed_ips , "use_server_dns" : use_server_dns , "enabled" : enabled , "public_key" : public_key , "preshared_key" : preshared_key } ;
551
579
552
580
$ . ajax ( {
553
581
cache : false ,
0 commit comments