diff options
author | Nicholas Smith <nicholas@nbembedded.com> | 2021-06-11 22:19:40 +1000 |
---|---|---|
committer | Jo-Philipp Wich <jo@mein.io> | 2021-07-13 20:10:04 +0200 |
commit | ebb676ef7b03a7fed4062931be147d43d3855b64 (patch) | |
tree | f0c846f509b3acec2f0d08cfe0e9e63d42e20eba /protocols/luci-proto-modemmanager/htdocs/luci-static/resources/protocol/modemmanager.js | |
parent | 98d1df8d24eb4c97fcf8ac78a9c04d342383b9c1 (diff) |
luci-proto-modemmanager: add APN and PIN validation
Signed-off-by: Nicholas Smith <nicholas@nbembedded.com>
[squash commits, fix white space]
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
Diffstat (limited to 'protocols/luci-proto-modemmanager/htdocs/luci-static/resources/protocol/modemmanager.js')
-rw-r--r-- | protocols/luci-proto-modemmanager/htdocs/luci-static/resources/protocol/modemmanager.js | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/protocols/luci-proto-modemmanager/htdocs/luci-static/resources/protocol/modemmanager.js b/protocols/luci-proto-modemmanager/htdocs/luci-static/resources/protocol/modemmanager.js index 3825b8ef16..88e516a8ec 100644 --- a/protocols/luci-proto-modemmanager/htdocs/luci-static/resources/protocol/modemmanager.js +++ b/protocols/luci-proto-modemmanager/htdocs/luci-static/resources/protocol/modemmanager.js @@ -91,8 +91,16 @@ return network.registerProtocol('modemmanager', { }, 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 (both)')); |