summaryrefslogtreecommitdiffhomepage
path: root/modules/admin-full/luasrc/model/cbi
diff options
context:
space:
mode:
authorSteven Barth <steven@midlink.org>2008-08-14 16:11:49 +0000
committerSteven Barth <steven@midlink.org>2008-08-14 16:11:49 +0000
commit36717208f1ae73290d352d706425e32f9726ff37 (patch)
treea1e7379764de6c34f6cd4178c0c330eb3becdcfb /modules/admin-full/luasrc/model/cbi
parent09145378c87cc1b8bad52d211b77f836a6130a9f (diff)
Fixed login form
Converted SSH-Keys to CBI-Map
Diffstat (limited to 'modules/admin-full/luasrc/model/cbi')
-rw-r--r--modules/admin-full/luasrc/model/cbi/admin_system/sshkeys.lua34
1 files changed, 34 insertions, 0 deletions
diff --git a/modules/admin-full/luasrc/model/cbi/admin_system/sshkeys.lua b/modules/admin-full/luasrc/model/cbi/admin_system/sshkeys.lua
new file mode 100644
index 0000000000..a204d420fc
--- /dev/null
+++ b/modules/admin-full/luasrc/model/cbi/admin_system/sshkeys.lua
@@ -0,0 +1,34 @@
+--[[
+LuCI - Lua Configuration Interface
+
+Copyright 2008 Steven Barth <steven@midlink.org>
+Copyright 2008 Jo-Philipp Wich <xm@leipzig.freifunk.net>
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+$Id$
+]]--
+local keyfile = "/etc/dropbear/authorized_keys"
+
+f = SimpleForm("sshkeys", translate("a_s_sshkeys"), translate("a_s_sshkeys1"))
+
+t = f:field(TextValue, "keys")
+t.rows = 10
+function t.cfgvalue()
+ return luci.fs.readfile(keyfile) or ""
+end
+
+function f.handle(self, state, data)
+ if state == FORM_VALID then
+ if (luci.fs.readfile(keyfile) or "") ~= data.keys then
+ luci.fs.writefile(keyfile, data.keys)
+ end
+ end
+ return true
+end
+
+return f \ No newline at end of file