WIP: support different interface types: improve placeholder values, allow bulk user creation for external email addresses
This commit is contained in:
parent
647fe92a03
commit
39903922dd
|
@ -96,7 +96,7 @@
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group col-md-6">
|
<div class="form-group col-md-6">
|
||||||
<label for="server_MTU">Client MTU</label>
|
<label for="server_MTU">Client MTU</label>
|
||||||
<input type="number" name="mtu" class="form-control" id="server_MTU" placeholder="0" value="{{.Peer.Mtu}}">
|
<input type="number" name="mtu" class="form-control" id="server_MTU" placeholder="" value="{{.Peer.Mtu}}">
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
@ -305,7 +305,7 @@
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group col-md-6">
|
<div class="form-group col-md-6">
|
||||||
<label for="custom_MTU">Client MTU</label>
|
<label for="custom_MTU">Client MTU</label>
|
||||||
<input type="number" name="mtu" class="form-control" id="custom_MTU" placeholder="0" value="{{.Peer.Mtu}}">
|
<input type="number" name="mtu" class="form-control" id="custom_MTU" placeholder="" value="{{.Peer.Mtu}}">
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
|
@ -74,6 +74,16 @@
|
||||||
<input type="text" name="ip" class="form-control" id="server_IPs" placeholder="10.6.6.1/24" value="{{.Device.IPsStr}}" required>
|
<input type="text" name="ip" class="form-control" id="server_IPs" placeholder="10.6.6.1/24" value="{{.Device.IPsStr}}" required>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="form-row">
|
||||||
|
<div class="form-group col-md-6">
|
||||||
|
<label for="server_FirewallMark">Firewall Mark</label>
|
||||||
|
<input type="number" name="firewallmark" class="form-control" id="server_FirewallMark" placeholder="0" value="{{.Device.FirewallMark}}">
|
||||||
|
</div>
|
||||||
|
<div class="form-group col-md-6">
|
||||||
|
<label for="server_RoutingTable">Routing Table</label>
|
||||||
|
<input type="text" name="routingtable" class="form-control" id="server_RoutingTable" placeholder="auto" value="{{.Device.RoutingTable}}">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
<h3>Client's global configuration</h3>
|
<h3>Client's global configuration</h3>
|
||||||
<div class="form-row">
|
<div class="form-row">
|
||||||
<div class="form-group required col-md-12">
|
<div class="form-group required col-md-12">
|
||||||
|
@ -94,7 +104,7 @@
|
||||||
<div class="form-row">
|
<div class="form-row">
|
||||||
<div class="form-group col-md-6">
|
<div class="form-group col-md-6">
|
||||||
<label for="server_MTU">Global MTU</label>
|
<label for="server_MTU">Global MTU</label>
|
||||||
<input type="number" name="mtu" class="form-control" id="server_MTU" placeholder="0" value="{{.Device.Mtu}}">
|
<input type="number" name="mtu" class="form-control" id="server_MTU" placeholder="" value="{{.Device.Mtu}}">
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group col-md-6">
|
<div class="form-group col-md-6">
|
||||||
<label for="server_PersistentKeepalive">Persistent Keepalive</label>
|
<label for="server_PersistentKeepalive">Persistent Keepalive</label>
|
||||||
|
@ -181,15 +191,15 @@
|
||||||
<div class="form-row">
|
<div class="form-row">
|
||||||
<div class="form-group col-md-4">
|
<div class="form-group col-md-4">
|
||||||
<label for="client_MTU">Global MTU</label>
|
<label for="client_MTU">Global MTU</label>
|
||||||
<input type="number" name="mtu" class="form-control" id="client_MTU" placeholder="0" value="{{.Device.Mtu}}">
|
<input type="number" name="mtu" class="form-control" id="client_MTU" placeholder="" value="{{.Device.Mtu}}">
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group col-md-4">
|
<div class="form-group col-md-4">
|
||||||
<label for="client_FirewallMark">Firewall Mark</label>
|
<label for="client_FirewallMark">Firewall Mark</label>
|
||||||
<input type="number" name="firewallmark" class="form-control" id="client_FirewallMark" placeholder="0" value="{{.Device.FirewallMark}}">
|
<input type="number" name="firewallmark" class="form-control" id="client_FirewallMark" placeholder="" value="{{.Device.FirewallMark}}">
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group col-md-4">
|
<div class="form-group col-md-4">
|
||||||
<label for="client_RoutingTable">Routing Table</label>
|
<label for="client_RoutingTable">Routing Table</label>
|
||||||
<input type="text" name="routingtable" class="form-control" id="client_RoutingTable" placeholder="0" value="{{.Device.RoutingTable}}">
|
<input type="text" name="routingtable" class="form-control" id="client_RoutingTable" placeholder="auto" value="{{.Device.RoutingTable}}">
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<h3>Interface configuration hooks</h3>
|
<h3>Interface configuration hooks</h3>
|
||||||
|
@ -271,11 +281,11 @@
|
||||||
<div class="form-row">
|
<div class="form-row">
|
||||||
<div class="form-group col-md-6">
|
<div class="form-group col-md-6">
|
||||||
<label for="custom_FirewallMark">Firewall Mark</label>
|
<label for="custom_FirewallMark">Firewall Mark</label>
|
||||||
<input type="number" name="firewallmark" class="form-control" id="custom_FirewallMark" placeholder="0" value="{{.Device.FirewallMark}}">
|
<input type="number" name="firewallmark" class="form-control" id="custom_FirewallMark" placeholder="" value="{{.Device.FirewallMark}}">
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group col-md-6">
|
<div class="form-group col-md-6">
|
||||||
<label for="custom_RoutingTable">Routing Table</label>
|
<label for="custom_RoutingTable">Routing Table</label>
|
||||||
<input type="text" name="routingtable" class="form-control" id="custom_RoutingTable" placeholder="0" value="{{.Device.RoutingTable}}">
|
<input type="text" name="routingtable" class="form-control" id="custom_RoutingTable" placeholder="auto" value="{{.Device.RoutingTable}}">
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-row">
|
<div class="form-row">
|
||||||
|
@ -312,7 +322,7 @@
|
||||||
<div class="form-row">
|
<div class="form-row">
|
||||||
<div class="form-group col-md-6">
|
<div class="form-group col-md-6">
|
||||||
<label for="custom_MTU">Global MTU</label>
|
<label for="custom_MTU">Global MTU</label>
|
||||||
<input type="number" name="mtu" class="form-control" id="custom_MTU" placeholder="0" value="{{.Device.Mtu}}">
|
<input type="number" name="mtu" class="form-control" id="custom_MTU" placeholder="" value="{{.Device.Mtu}}">
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<h3>Interface configuration hooks</h3>
|
<h3>Interface configuration hooks</h3>
|
||||||
|
|
|
@ -58,8 +58,6 @@ func (s *Server) PostAdminEditInterface(c *gin.Context) {
|
||||||
formDevice.DefaultPersistentKeepalive = 0
|
formDevice.DefaultPersistentKeepalive = 0
|
||||||
formDevice.SaveConfig = false
|
formDevice.SaveConfig = false
|
||||||
case wireguard.DeviceTypeServer:
|
case wireguard.DeviceTypeServer:
|
||||||
formDevice.FirewallMark = 0
|
|
||||||
formDevice.RoutingTable = ""
|
|
||||||
formDevice.SaveConfig = false
|
formDevice.SaveConfig = false
|
||||||
case wireguard.DeviceTypeCustom:
|
case wireguard.DeviceTypeCustom:
|
||||||
}
|
}
|
||||||
|
|
|
@ -175,7 +175,7 @@ func (s *Server) PostAdminCreateLdapPeers(c *gin.Context) {
|
||||||
emails := common.ParseStringList(formData.Emails)
|
emails := common.ParseStringList(formData.Emails)
|
||||||
for i := range emails {
|
for i := range emails {
|
||||||
// TODO: also check email addr for validity?
|
// 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)
|
_ = s.updateFormInSession(c, formData)
|
||||||
SetFlashMessage(c, "invalid email address: "+emails[i], "danger")
|
SetFlashMessage(c, "invalid email address: "+emails[i], "danger")
|
||||||
c.Redirect(http.StatusSeeOther, "/admin/peer/createldap?formerr=mail")
|
c.Redirect(http.StatusSeeOther, "/admin/peer/createldap?formerr=mail")
|
||||||
|
|
Loading…
Reference in New Issue