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

25 lines
597 B
Lua
Raw Normal View History

2020-01-24 20:04:26 +00:00
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