1 module("ffluci.controller.admin.system", package.seeall)
8 function action_editor()
9 local file = ffluci.http.formvalue("file", "")
10 local data = ffluci.http.formvalue("data")
16 stat, err = ffluci.fs.writefile(file, data)
20 err = ffluci.util.split(err, " ")
22 msg = table.concat(err, " ")
25 local cnt, err = ffluci.fs.readfile(file)
27 cnt = ffluci.util.pcdata(cnt)
29 ffluci.template.render("admin_system/editor", {fn=file, cnt=cnt, msg=msg})
32 function action_passwd()
33 local p1 = ffluci.http.formvalue("pwd1")
34 local p2 = ffluci.http.formvalue("pwd2")
39 stat = ffluci.sys.user.setpasswd("root", p1)
45 ffluci.template.render("admin_system/passwd", {stat=stat})
48 function action_reboot()
49 ffluci.template.render("admin_system/reboot")
53 function action_sshkeys()
54 local file = "/etc/dropbear/authorized_keys"
55 local data = ffluci.http.formvalue("data")
60 stat, err = ffluci.fs.writefile(file, data)
63 local cnt = ffluci.fs.readfile(file)
65 cnt = ffluci.util.pcdata(cnt)
68 ffluci.template.render("admin_system/sshkeys", {cnt=cnt, msg=err})