mirror of
https://github.com/Doodle3D/doodle3d-firmware.git
synced 2025-01-03 08:13:49 +01:00
Access point key validation function and handling validation function messages in general
This commit is contained in:
parent
a85528e956
commit
72678ef1cc
@ -47,8 +47,17 @@ 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 = {
|
||||||
|
@ -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
|
||||||
|
Loading…
Reference in New Issue
Block a user