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>
(cherry picked from commit 1661ac6bf8
)
This commit is contained in:
parent
f8ea3df634
commit
ebfdbce797
1 changed files with 11 additions and 2 deletions
|
@ -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'));
|
||||
|
|
Loading…
Reference in a new issue