luci-proto-wireguard: fix preshared key validation
[project/luci.git] / protocols / luci-proto-wireguard / htdocs / luci-static / resources / protocol / wireguard.js
index 6742f2ab9964f7ed2f0cc863f93d603b1a193f9c..ab76326eee428c972d82b6662a9b29fcb0f4d133 100644 (file)
@@ -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');