diff options
author | Martin Schiller <ms@dev.tdt.de> | 2017-12-19 09:54:09 +0100 |
---|---|---|
committer | Martin Schiller <ms@dev.tdt.de> | 2018-02-15 06:14:24 +0100 |
commit | 7c643558a32e330ccb667f95ac8b6626fc86458d (patch) | |
tree | b4bc685f9d57c613b38b7c58452f7a3579110738 | |
parent | bab9c12e20f545ec7aff559d18be8364a3d1c725 (diff) |
luci-app-openvpn: fix validity check for new instance input field
Signed-off-by: Martin Schiller <ms@dev.tdt.de>
-rw-r--r-- | applications/luci-app-openvpn/luasrc/model/cbi/openvpn.lua | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/applications/luci-app-openvpn/luasrc/model/cbi/openvpn.lua b/applications/luci-app-openvpn/luasrc/model/cbi/openvpn.lua index 6433229f6..d5e0019eb 100644 --- a/applications/luci-app-openvpn/luasrc/model/cbi/openvpn.lua +++ b/applications/luci-app-openvpn/luasrc/model/cbi/openvpn.lua @@ -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 |