projects
/
project
/
luci.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
02bed26
)
luci-base: add hexstring datatype
author
Hannu Nyman
<hannu.nyman@iki.fi>
Thu, 9 Feb 2017 14:58:07 +0000
(16:58 +0200)
committer
Hannu Nyman
<hannu.nyman@iki.fi>
Thu, 9 Feb 2017 14:58:07 +0000
(16:58 +0200)
Add datatype 'hexstring' for input validaiton datatypes.
It will accept any hexadecimal string.
(no length validation, as rangelength can be used for that.)
Signed-off-by: Hannu Nyman <hannu.nyman@iki.fi>
modules/luci-base/luasrc/cbi/datatypes.lua
patch
|
blob
|
history
diff --git
a/modules/luci-base/luasrc/cbi/datatypes.lua
b/modules/luci-base/luasrc/cbi/datatypes.lua
index 72b41ddad89386e4a13c6e715cf747643f67cb60..0a180d366455e1e823c349f537ba21b98d1f789d 100644
(file)
--- a/
modules/luci-base/luasrc/cbi/datatypes.lua
+++ b/
modules/luci-base/luasrc/cbi/datatypes.lua
@@
-267,6
+267,13
@@
function wepkey(val)
end
end
+function hexstring(val)
+ if val then
+ return (val:match("^[a-fA-F0-9]+$") ~= nil)
+ end
+ return false
+end
+
function string(val)
return true -- Everything qualifies as valid string
end