From 39903922dde07d235d4bbb185ae1cb96fc82662e Mon Sep 17 00:00:00 2001 From: Christoph Haas Date: Sun, 4 Apr 2021 00:04:59 +0200 Subject: [PATCH] WIP: support different interface types: improve placeholder values, allow bulk user creation for external email addresses --- assets/tpl/admin_edit_client.html | 4 ++-- assets/tpl/admin_edit_interface.html | 24 +++++++++++++++++------- internal/server/handlers_interface.go | 2 -- internal/server/handlers_peer.go | 2 +- 4 files changed, 20 insertions(+), 12 deletions(-) diff --git a/assets/tpl/admin_edit_client.html b/assets/tpl/admin_edit_client.html index c34b419..419c601 100644 --- a/assets/tpl/admin_edit_client.html +++ b/assets/tpl/admin_edit_client.html @@ -96,7 +96,7 @@
- +
@@ -305,7 +305,7 @@
- +
diff --git a/assets/tpl/admin_edit_interface.html b/assets/tpl/admin_edit_interface.html index 50c3e6b..1af2c9c 100644 --- a/assets/tpl/admin_edit_interface.html +++ b/assets/tpl/admin_edit_interface.html @@ -74,6 +74,16 @@ +
+
+ + +
+
+ + +
+

Client's global configuration

@@ -94,7 +104,7 @@
- +
@@ -181,15 +191,15 @@
- +
- +
- +

Interface configuration hooks

@@ -271,11 +281,11 @@
- +
- +
@@ -312,7 +322,7 @@
- +

Interface configuration hooks

diff --git a/internal/server/handlers_interface.go b/internal/server/handlers_interface.go index 67a0cb6..cf20c15 100644 --- a/internal/server/handlers_interface.go +++ b/internal/server/handlers_interface.go @@ -58,8 +58,6 @@ func (s *Server) PostAdminEditInterface(c *gin.Context) { formDevice.DefaultPersistentKeepalive = 0 formDevice.SaveConfig = false case wireguard.DeviceTypeServer: - formDevice.FirewallMark = 0 - formDevice.RoutingTable = "" formDevice.SaveConfig = false case wireguard.DeviceTypeCustom: } diff --git a/internal/server/handlers_peer.go b/internal/server/handlers_peer.go index 9dd99ec..7e12e35 100644 --- a/internal/server/handlers_peer.go +++ b/internal/server/handlers_peer.go @@ -175,7 +175,7 @@ func (s *Server) PostAdminCreateLdapPeers(c *gin.Context) { emails := common.ParseStringList(formData.Emails) for i := range emails { // TODO: also check email addr for validity? - if !strings.ContainsRune(emails[i], '@') || s.users.GetUser(emails[i]) == nil { + if !strings.ContainsRune(emails[i], '@') { _ = s.updateFormInSession(c, formData) SetFlashMessage(c, "invalid email address: "+emails[i], "danger") c.Redirect(http.StatusSeeOther, "/admin/peer/createldap?formerr=mail")