diff options
author | Nicholas Smith <nicholas@nbembedded.com> | 2021-06-11 22:40:30 +1000 |
---|---|---|
committer | Jo-Philipp Wich <jo@mein.io> | 2021-07-13 20:10:04 +0200 |
commit | 6a8ad40b057e6a7f0d3343ec06dbe487b352fe47 (patch) | |
tree | 34fb5ce62b07eba2410c8c4a723458edef4796fe /protocols/luci-proto-3g | |
parent | ebb676ef7b03a7fed4062931be147d43d3855b64 (diff) |
luci-proto-3g: 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-3g')
-rw-r--r-- | protocols/luci-proto-3g/htdocs/luci-static/resources/protocol/3g.js | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/protocols/luci-proto-3g/htdocs/luci-static/resources/protocol/3g.js b/protocols/luci-proto-3g/htdocs/luci-static/resources/protocol/3g.js index ee4927a027..d0d8b4a677 100644 --- a/protocols/luci-proto-3g/htdocs/luci-static/resources/protocol/3g.js +++ b/protocols/luci-proto-3g/htdocs/luci-static/resources/protocol/3g.js @@ -92,8 +92,17 @@ return network.registerProtocol('3g', { o.value('gprs_only', _('GPRS only')); o.value('evdo', 'CDMA/EV-DO'); - 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')); |