summaryrefslogtreecommitdiffhomepage
path: root/protocols
diff options
context:
space:
mode:
authorNicholas Smith <nicholas@nbembedded.com>2021-06-11 22:41:14 +1000
committerJo-Philipp Wich <jo@mein.io>2021-07-13 20:10:04 +0200
commit114dc38dc2ce82a9f32fdc16adaa6f435ee36881 (patch)
treed74b74182fe665f0cee2fdc0430b8108ea08995d /protocols
parent6a8ad40b057e6a7f0d3343ec06dbe487b352fe47 (diff)
luci-proto-qmi: add APN and PIN validation
Signed-off-by: Nicholas Smith <nicholas@nbembedded.com> [squash commits, fix whitespace] Signed-off-by: Jo-Philipp Wich <jo@mein.io>
Diffstat (limited to 'protocols')
-rw-r--r--protocols/luci-proto-qmi/htdocs/luci-static/resources/protocol/qmi.js14
1 files changed, 11 insertions, 3 deletions
diff --git a/protocols/luci-proto-qmi/htdocs/luci-static/resources/protocol/qmi.js b/protocols/luci-proto-qmi/htdocs/luci-static/resources/protocol/qmi.js
index 7c9e72cb1a..def275a1c6 100644
--- a/protocols/luci-proto-qmi/htdocs/luci-static/resources/protocol/qmi.js
+++ b/protocols/luci-proto-qmi/htdocs/luci-static/resources/protocol/qmi.js
@@ -65,8 +65,16 @@ return network.registerProtocol('qmi', {
}, this));
};
- s.taboption('general', form.Value, 'apn', _('APN'));
- s.taboption('general', form.Value, 'pincode', _('PIN'));
+ o = s.taboption('general', form.Value, 'apn', _('APN'));
+ o.validate = function(section_id, value) {
+ if (!/^[a-zA-Z0-9\-.]*[a-zA-Z0-9]$/.test(value))
+ return _('Invalid APN provided');
+
+ return true;
+ };
+
+ o = s.taboption('general', form.Value, 'pincode', _('PIN'));
+ o.datatype = 'and(uinteger,minlength(4),maxlength(8))';
o = s.taboption('general', form.ListValue, 'auth', _('Authentication Type'));
o.value('both', 'PAP/CHAP');
@@ -99,7 +107,7 @@ return network.registerProtocol('qmi', {
o = s.taboption('advanced', form.Value, 'mtu', _('Override MTU'));
o.placeholder = dev ? (dev.getMTU() || '1500') : '1500';
o.datatype = 'max(9200)';
-
+
o = s.taboption('general', form.ListValue, 'pdptype', _('PDP Type'));
o.value('ipv4v6', 'IPv4/IPv6');
o.value('ipv4', 'IPv4');