1 module("ffluci.controller.admin.system", package.seeall)
12 {action = "passwd", descr = "Passwort ändern"},
13 {action = "sshkeys", descr = "SSH-Schlüssel"},
14 {action = "reboot", descr = "Neu starten"},
18 function action_editor()
19 local file = ffluci.http.formvalue("file", "")
20 local data = ffluci.http.formvalue("data")
26 stat, err = ffluci.fs.writefile(file, data)
30 err = ffluci.util.split(err, " ")
32 msg = table.concat(err, " ")
35 local cnt, err = ffluci.fs.readfile(file)
37 cnt = ffluci.util.pcdata(cnt)
39 ffluci.template.render("admin_system/editor", {fn=file, cnt=cnt, msg=msg})
42 function action_passwd()
43 local p1 = ffluci.http.formvalue("pwd1")
44 local p2 = ffluci.http.formvalue("pwd2")
49 stat = ffluci.sys.user.setpasswd("root", p1)
55 ffluci.template.render("admin_system/passwd", {stat=stat})
58 function action_reboot()
59 ffluci.template.render("admin_system/reboot")
63 function action_sshkeys()
64 local file = "/etc/dropbear/authorized_keys"
65 local data = ffluci.http.formvalue("data")
70 stat, err = ffluci.fs.writefile(file, data)
73 local cnt = ffluci.fs.readfile(file)
75 cnt = ffluci.util.pcdata(cnt)
78 ffluci.template.render("admin_system/sshkeys", {cnt=cnt, msg=err})