0
0
mirror of https://github.com/Doodle3D/doodle3d-firmware.git synced 2024-06-28 20:31:21 +02:00

Access point key validation function and handling validation function messages in general

This commit is contained in:
peteruithoven 2013-10-17 15:28:57 +02:00
parent a85528e956
commit 72678ef1cc
2 changed files with 17 additions and 7 deletions

View File

@ -44,11 +44,20 @@ M.network_ap_address = {
} }
M.network_ap_key = { M.network_ap_key = {
default = '', default = '',
type = 'string', type = 'string',
description = 'Access Point security key', description = 'Access Point security key',
min = 8, isValid = function(value)
max = 63 if value == "" then
return true;
elseif value:len() < 8 then
return false, "to short"
elseif value:len() > 63 then
return false, "to long"
else
return true
end
end
} }
M.network_ap_netmask = { M.network_ap_netmask = {

View File

@ -100,8 +100,9 @@ local function isValid(value, baseTable)
local varType, min, max, regex, isValid = baseTable.type, baseTable.min, baseTable.max, baseTable.regex, baseTable.isValid local varType, min, max, regex, isValid = baseTable.type, baseTable.min, baseTable.max, baseTable.regex, baseTable.isValid
if isValid then if isValid then
local ok = isValid(value) local ok,msg = isValid(value)
return ok or nil,"invalid value" if msg == nil then msg = "invalid value" end
return ok or nil,msg
end end
if varType == 'bool' then if varType == 'bool' then