mirror of
https://github.com/Ysurac/openmptcprouter-feeds.git
synced 2025-02-15 03:51:51 +00:00
25 lines
597 B
Lua
25 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
|