1
0
Fork 0
mirror of https://github.com/Ysurac/openmptcprouter-feeds.git synced 2025-02-15 03:51:51 +00:00
openmptcprouter-feeds/luci-app-ipsec-vpnd/luasrc/model/cbi/ipsec-server/userlist.lua
Ycarus (Yannick Chabanois) bf4ee2cc5e Add ipsec support
2020-01-24 21:04:26 +01:00

24 lines
597 B
Lua

local fs = require "nixio.fs"
local conffile = "/etc/config/ipsec.users"
f = SimpleForm("custom", translate("IPSec VPN User List"), translate("Please refer to the following writing.account:password"))
t = f:field(TextValue, "conf")
t.rmempty = true
t.rows = 13
function t.cfgvalue()
return fs.readfile(conffile) or ""
end
function f.handle(self, state, data)
if state == FORM_VALID then
if data.conf then
fs.writefile(conffile, data.conf:gsub("\r\n", "\n"))
luci.sys.call("/etc/init.d/ipsec reload")
luci.sys.call("/etc/init.d/ipsec restart")
end
end
return true
end
return f