luci-app-openvpn: fix validity check for new instance input field

Signed-off-by: Martin Schiller <ms@dev.tdt.de>
This commit is contained in:
Martin Schiller 2017-12-19 09:54:09 +01:00
parent bab9c12e20
commit 7c643558a3

View file

@ -56,7 +56,7 @@ function s.create(self, name)
luci.cbi.CREATE_PREFIX .. self.config .. "." ..
self.sectiontype .. ".text"
)
if string.len(name)>3 and not name:match("[^a-zA-Z0-9_]") then
if #name > 3 and not name:match("[^a-zA-Z0-9_]") then
uci:section(
"openvpn", "openvpn", name,
uci:get_all( "openvpn_recipes", recipe )
@ -67,9 +67,11 @@ function s.create(self, name)
uci:save("openvpn")
luci.http.redirect( self.extedit:format(name) )
else
elseif #name > 0 then
self.invalid_cts = true
end
return 0
end