applications/openvpn: properly handle invalid names when defining new instances
This commit is contained in:
parent
59d70787b4
commit
f72c9704ae
1 changed files with 12 additions and 8 deletions
|
@ -53,16 +53,20 @@ function s.create(self, name)
|
||||||
self.sectiontype .. ".select"
|
self.sectiontype .. ".select"
|
||||||
)
|
)
|
||||||
|
|
||||||
uci:section(
|
if name and not name:match("[^a-zA-Z0-9_]") then
|
||||||
"openvpn", "openvpn", name,
|
uci:section(
|
||||||
uci:get_all( "openvpn_recipes", recipe )
|
"openvpn", "openvpn", name,
|
||||||
)
|
uci:get_all( "openvpn_recipes", recipe )
|
||||||
|
)
|
||||||
|
|
||||||
uci:delete("openvpn", name, "_role")
|
uci:delete("openvpn", name, "_role")
|
||||||
uci:delete("openvpn", name, "_description")
|
uci:delete("openvpn", name, "_description")
|
||||||
uci:save("openvpn")
|
uci:save("openvpn")
|
||||||
|
|
||||||
luci.http.redirect( self.extedit:format(name) )
|
luci.http.redirect( self.extedit:format(name) )
|
||||||
|
else
|
||||||
|
self.invalid_cts = true
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue