diff --git a/assets/css/custom.css b/assets/css/custom.css index 8d993fd..6bc0d62 100644 --- a/assets/css/custom.css +++ b/assets/css/custom.css @@ -65,4 +65,9 @@ pre{background:#f7f7f9}iframe{overflow:hidden;border:none}@media (min-width: 768 background-color: #f7f7f9; margin: -4px 5px 5px 0; height: 22px; +} + +.form-group.required label:after { + content:"*"; + color:red; } \ No newline at end of file diff --git a/assets/tpl/admin_create_clients.html b/assets/tpl/admin_create_clients.html index b36bbe7..fab3dec 100644 --- a/assets/tpl/admin_create_clients.html +++ b/assets/tpl/admin_create_clients.html @@ -21,13 +21,13 @@ {{template "prt_flashes.html" .}}
-
+
-
+
diff --git a/assets/tpl/admin_edit_client.html b/assets/tpl/admin_edit_client.html index 92aa68c..f42338c 100644 --- a/assets/tpl/admin_edit_client.html +++ b/assets/tpl/admin_edit_client.html @@ -31,7 +31,7 @@
-
+
@@ -53,25 +53,25 @@
{{end}}
-
+
-
+
-
+
-
+
diff --git a/assets/tpl/admin_edit_interface.html b/assets/tpl/admin_edit_interface.html index 3d9b9fe..a7c97f0 100644 --- a/assets/tpl/admin_edit_interface.html +++ b/assets/tpl/admin_edit_interface.html @@ -18,27 +18,42 @@ -

Server's interface configuration

+ {{if .EditableKeys}} +
+
+ + +
+
+
+
+ + +
+
+ {{else}} +
+ {{end}}
-
+
-
+

Client's global configuration

-
+
diff --git a/internal/server/handlers_interface.go b/internal/server/handlers_interface.go index 5d2b3f9..6443bbf 100644 --- a/internal/server/handlers_interface.go +++ b/internal/server/handlers_interface.go @@ -19,19 +19,21 @@ func (s *Server) GetAdminEditInterface(c *gin.Context) { } c.HTML(http.StatusOK, "admin_edit_interface.html", struct { - Route string - Alerts []FlashData - Session SessionData - Static StaticData - Peers []User - Device Device + Route string + Alerts []FlashData + Session SessionData + Static StaticData + Peers []User + Device Device + EditableKeys bool }{ - Route: c.Request.URL.Path, - Alerts: s.getFlashes(c), - Session: currentSession, - Static: s.getStaticData(), - Peers: users, - Device: currentSession.FormData.(Device), + Route: c.Request.URL.Path, + Alerts: s.getFlashes(c), + Session: currentSession, + Static: s.getStaticData(), + Peers: users, + Device: currentSession.FormData.(Device), + EditableKeys: s.config.Core.EditableKeys, }) } diff --git a/internal/server/usermanager.go b/internal/server/usermanager.go index 0de1759..e7d7db2 100644 --- a/internal/server/usermanager.go +++ b/internal/server/usermanager.go @@ -202,7 +202,7 @@ type Device struct { Interface *wgtypes.Device `gorm:"-"` DeviceName string `form:"device" gorm:"primaryKey" binding:"required,alphanum"` - PrivateKey string `form:"privkey" binding:"base64"` + PrivateKey string `form:"privkey" binding:"required,base64"` PublicKey string `form:"pubkey" binding:"required,base64"` PersistentKeepalive int `form:"keepalive" binding:"gte=0"` ListenPort int `form:"port" binding:"required,gt=0"`