summaryrefslogtreecommitdiffhomepage
path: root/applications/luci-app-openvpn/luasrc/model/cbi/openvpn.lua
diff options
context:
space:
mode:
authorDirk Brenken <dev@brenken.org>2018-09-16 18:58:26 +0200
committerDirk Brenken <dev@brenken.org>2018-09-17 14:22:14 +0200
commitc2656a722097a7b4004d2da9c223b347cfa1a4af (patch)
treec9606e591bcb472341e48e05a6329caa40131312 /applications/luci-app-openvpn/luasrc/model/cbi/openvpn.lua
parent5cb6c1c698a8e4d7214ed5d18d5324df8c3faed6 (diff)
luci-app-openvpn: remove obsolete config options
* remove obsolete config options according to openwrt/openwrt@89b8ba9, fix for #2135 * whitespace/intendation fixes * replace fieldset leftover with div * fix finally recipe options transfer to regular config with "Add" Signed-off-by: Dirk Brenken <dev@brenken.org>
Diffstat (limited to 'applications/luci-app-openvpn/luasrc/model/cbi/openvpn.lua')
-rw-r--r--applications/luci-app-openvpn/luasrc/model/cbi/openvpn.lua23
1 files changed, 12 insertions, 11 deletions
diff --git a/applications/luci-app-openvpn/luasrc/model/cbi/openvpn.lua b/applications/luci-app-openvpn/luasrc/model/cbi/openvpn.lua
index 93a901e9b8..e17aa4085b 100644
--- a/applications/luci-app-openvpn/luasrc/model/cbi/openvpn.lua
+++ b/applications/luci-app-openvpn/luasrc/model/cbi/openvpn.lua
@@ -52,21 +52,22 @@ function s.create(self, name)
luci.cbi.CREATE_PREFIX .. self.config .. "." ..
self.sectiontype .. ".select"
)
- name = luci.http.formvalue(
+ local name = luci.http.formvalue(
luci.cbi.CREATE_PREFIX .. self.config .. "." ..
self.sectiontype .. ".text"
)
if #name > 3 and not name:match("[^a-zA-Z0-9_]") then
- uci:section(
- "openvpn", "openvpn", name,
- { uci:get_all( "openvpn_recipes", recipe ) }
- )
-
- uci:delete("openvpn", name, "_role")
- uci:delete("openvpn", name, "_description")
- uci:save("openvpn")
-
- luci.http.redirect( self.extedit:format(name) )
+ local s = uci:section("openvpn", "openvpn", name)
+ if s then
+ local options = uci:get_all("openvpn_recipes", recipe)
+ for k, v in pairs(options) do
+ uci:set("openvpn", name, k, v)
+ end
+ uci:delete("openvpn", name, "_role")
+ uci:delete("openvpn", name, "_description")
+ uci:save("openvpn")
+ luci.http.redirect( self.extedit:format(name) )
+ end
elseif #name > 0 then
self.invalid_cts = true
end