diff options
author | Jo-Philipp Wich <jo@mein.io> | 2019-09-17 08:28:45 +0200 |
---|---|---|
committer | Jo-Philipp Wich <jo@mein.io> | 2019-09-17 08:28:45 +0200 |
commit | 995322c55fb23c82a36ea3966219401b4fee6c77 (patch) | |
tree | 5acecf9f808380996ba3caa37e6610540a22c527 /protocols/luci-proto-wireguard/htdocs/luci-static | |
parent | fbfb4af326b7361e5ec0bec8e573c474d7c95285 (diff) |
luci-proto-wireguard: fix preshared key validation
Ensure that the preshared key option remains optional.
Fixes: #3075
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
Diffstat (limited to 'protocols/luci-proto-wireguard/htdocs/luci-static')
-rw-r--r-- | protocols/luci-proto-wireguard/htdocs/luci-static/resources/protocol/wireguard.js | 3 |
1 files changed, 3 insertions, 0 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 6742f2ab99..ab76326eee 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 @@ -3,6 +3,9 @@ 'require network'; function validateBase64(section_id, value) { + if (value.length == 0) + return true; + if (value.length != 44 || !value.match(/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/)) return _('Invalid Base64 key string'); |