mirror of
https://github.com/Doodle3D/doodle3d-firmware.git
synced 2024-12-22 11:03:48 +01:00
Access point key validation function and handling validation function messages in general
This commit is contained in:
parent
a85528e956
commit
72678ef1cc
@ -44,11 +44,20 @@ M.network_ap_address = {
|
||||
}
|
||||
|
||||
M.network_ap_key = {
|
||||
default = '',
|
||||
type = 'string',
|
||||
description = 'Access Point security key',
|
||||
min = 8,
|
||||
max = 63
|
||||
default = '',
|
||||
type = 'string',
|
||||
description = 'Access Point security key',
|
||||
isValid = function(value)
|
||||
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 = {
|
||||
|
@ -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
|
||||
|
||||
if isValid then
|
||||
local ok = isValid(value)
|
||||
return ok or nil,"invalid value"
|
||||
local ok,msg = isValid(value)
|
||||
if msg == nil then msg = "invalid value" end
|
||||
return ok or nil,msg
|
||||
end
|
||||
|
||||
if varType == 'bool' then
|
||||
|
Loading…
Reference in New Issue
Block a user