luci-app-openvpn: fix validity check for new instance input field
authorMartin Schiller <ms@dev.tdt.de>
Tue, 19 Dec 2017 08:54:09 +0000 (09:54 +0100)
committerMartin Schiller <ms@dev.tdt.de>
Thu, 15 Feb 2018 05:14:24 +0000 (06:14 +0100)
Signed-off-by: Martin Schiller <ms@dev.tdt.de>
applications/luci-app-openvpn/luasrc/model/cbi/openvpn.lua

index 6433229f690e1099191f2427f78e92d0eab9787f..d5e0019eb7af959f37ee7f7adb8b8a3d4ad662ee 100644 (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