Skip to content

Commit

Permalink
luci-proto-mbim: add APN and PIN validation
Browse files Browse the repository at this point in the history
Same as 114dc38

Signed-off-by: Howard Chu <hyc@symas.com>
  • Loading branch information
hyc committed Jul 21, 2021
1 parent b26367a commit 52bccd6
Showing 1 changed file with 10 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,16 @@ return network.registerProtocol('mbim', {
}, 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');
Expand Down

0 comments on commit 52bccd6

Please sign in to comment.