diff options
author | Hannu Nyman <hannu.nyman@iki.fi> | 2017-02-09 16:58:07 +0200 |
---|---|---|
committer | Hannu Nyman <hannu.nyman@iki.fi> | 2017-02-09 16:58:07 +0200 |
commit | 11f23559e4be78f202aa55d811d5b58cb0ca0a78 (patch) | |
tree | d1cafc213455ee135719377e2a03b8c29eb56de6 /modules | |
parent | 02bed261881dd60f212f81e7ed3e3afeb4bd890d (diff) |
luci-base: add hexstring datatype
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>
Diffstat (limited to 'modules')
-rw-r--r-- | modules/luci-base/luasrc/cbi/datatypes.lua | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/modules/luci-base/luasrc/cbi/datatypes.lua b/modules/luci-base/luasrc/cbi/datatypes.lua index 72b41ddad8..0a180d3664 100644 --- 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 |