protocols: make APN option optional again
authorJo-Philipp Wich <jo@mein.io>
Thu, 19 Aug 2021 06:59:17 +0000 (08:59 +0200)
committerJo-Philipp Wich <jo@mein.io>
Thu, 19 Aug 2021 06:59:17 +0000 (08:59 +0200)
Fixes: #5284
Fixes: 1661ac6bf8 ("luci-proto-ncm: add APN and PIN validation")
Fixes: 114dc38dc2 ("luci-proto-qmi: add APN and PIN validation")
Fixes: 6a8ad40b05 ("luci-proto-3g: add APN and PIN validation")
Fixes: ebb676ef7b ("luci-proto-modemmanager: add APN and PIN validation")
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
protocols/luci-proto-3g/htdocs/luci-static/resources/protocol/3g.js
protocols/luci-proto-modemmanager/htdocs/luci-static/resources/protocol/modemmanager.js
protocols/luci-proto-ncm/htdocs/luci-static/resources/protocol/ncm.js
protocols/luci-proto-qmi/htdocs/luci-static/resources/protocol/qmi.js

index d0d8b4a677bc767418e763b73c994f3225520179..a1c54984a60bb7d1325fbf858b2346b3e56b73d0 100644 (file)
@@ -94,6 +94,9 @@ return network.registerProtocol('3g', {
 
                o = s.taboption('general', form.Value, 'apn', _('APN'));
                o.validate = function(section_id, value) {
+                       if (value == null || value == '')
+                               return true;
+
                        if (!/^[a-zA-Z0-9\-.]*[a-zA-Z0-9]$/.test(value))
                                return _('Invalid APN provided');
 
index 88e516a8ece73244114ef3f8e3e91c45d0682014..501f759646afb44553cd33436aacf6f2dbf76a4a 100644 (file)
@@ -93,6 +93,9 @@ return network.registerProtocol('modemmanager', {
 
                o = s.taboption('general', form.Value, 'apn', _('APN'));
                o.validate = function(section_id, value) {
+                       if (value == null || value == '')
+                               return true;
+
                        if (!/^[a-zA-Z0-9\-.]*[a-zA-Z0-9]$/.test(value))
                                return _('Invalid APN provided');
 
index 4d2f446793d9190e0e7c115e6fd7c1eaecfcacee..95b52978115be8093a7f122161555ad9cf18faf7 100644 (file)
@@ -86,6 +86,9 @@ return network.registerProtocol('ncm', {
 
                o = s.taboption('general', form.Value, 'apn', _('APN'));
                o.validate = function(section_id, value) {
+                       if (value == null || value == '')
+                               return true;
+
                        if (!/^[a-zA-Z0-9\-.]*[a-zA-Z0-9]$/.test(value))
                                        return _('Invalid APN provided');
 
index def275a1c6fa930ac4f2cdcd53e7562172238302..98ae486d37110e1c35c02a60323bc53cdf8b98f1 100644 (file)
@@ -67,6 +67,9 @@ return network.registerProtocol('qmi', {
 
                o = s.taboption('general', form.Value, 'apn', _('APN'));
                o.validate = function(section_id, value) {
+                       if (value == null || value == '')
+                               return true;
+
                        if (!/^[a-zA-Z0-9\-.]*[a-zA-Z0-9]$/.test(value))
                                return _('Invalid APN provided');