diff options
author | Nicholas Smith <nicholas@nbembedded.com> | 2021-06-27 15:43:13 +1000 |
---|---|---|
committer | Jo-Philipp Wich <jo@mein.io> | 2021-07-13 20:10:04 +0200 |
commit | 1661ac6bf888e4563546cc63fe0e228af8889bf0 (patch) | |
tree | 4126eddf555c36fb01b14f68a1103b8fc6da9fba /protocols/luci-proto-ncm/htdocs/luci-static/resources/protocol/ncm.js | |
parent | 114dc38dc2ce82a9f32fdc16adaa6f435ee36881 (diff) |
luci-proto-ncm: 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/luci-proto-ncm/htdocs/luci-static/resources/protocol/ncm.js')
-rw-r--r-- | protocols/luci-proto-ncm/htdocs/luci-static/resources/protocol/ncm.js | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/protocols/luci-proto-ncm/htdocs/luci-static/resources/protocol/ncm.js b/protocols/luci-proto-ncm/htdocs/luci-static/resources/protocol/ncm.js index 0daa7c16c1..4d2f446793 100644 --- a/protocols/luci-proto-ncm/htdocs/luci-static/resources/protocol/ncm.js +++ b/protocols/luci-proto-ncm/htdocs/luci-static/resources/protocol/ncm.js @@ -84,8 +84,17 @@ return network.registerProtocol('ncm', { o.value('IPV4V6', _('IPv4+IPv6')); o.value('IPV6', _('IPv6')); - 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))'; + s.taboption('general', form.Value, 'username', _('PAP/CHAP username')); o = s.taboption('general', form.Value, 'password', _('PAP/CHAP password')); |