summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorFlorian Eckert <fe@dev.tdt.de>2020-04-16 16:51:41 +0200
committerFlorian Eckert <fe@dev.tdt.de>2020-05-13 15:34:27 +0200
commit59bc3173268313bb4546aa1c6da2309da408250d (patch)
tree4fa887a64a0f79b3a1e8cd7ac99f0ba1d6770cfb
parentf01b43c698719b17063fb6d919e47004b9d22858 (diff)
luci-proto-wireguard: add warning that allowed_ips must not be empty
Signed-off-by: Florian Eckert <fe@dev.tdt.de>
-rw-r--r--protocols/luci-proto-wireguard/htdocs/luci-static/resources/protocol/wireguard.js9
1 files changed, 8 insertions, 1 deletions
diff --git a/protocols/luci-proto-wireguard/htdocs/luci-static/resources/protocol/wireguard.js b/protocols/luci-proto-wireguard/htdocs/luci-static/resources/protocol/wireguard.js
index 46cf53798..49f61c782 100644
--- a/protocols/luci-proto-wireguard/htdocs/luci-static/resources/protocol/wireguard.js
+++ b/protocols/luci-proto-wireguard/htdocs/luci-static/resources/protocol/wireguard.js
@@ -124,7 +124,14 @@ return network.registerProtocol('wireguard', {
o = ss.option(form.DynamicList, 'allowed_ips', _('Allowed IPs'), _("Required. IP addresses and prefixes that this peer is allowed to use inside the tunnel. Usually the peer's tunnel IP addresses and the networks the peer routes through the tunnel."));
o.datatype = 'ipaddr';
- o.rmempty = false;
+ o.validate = function(section, value) {
+ var opt = this.map.lookupOption('allowed_ips', section);
+ var ips = opt[0].formvalue(section);
+ if (ips.length == 0) {
+ return _('Value must not be empty');
+ }
+ return true;
+ };
o = ss.option(form.Flag, 'route_allowed_ips', _('Route Allowed IPs'), _('Optional. Create routes for Allowed IPs for this peer.'));