gluon-luci-admin: replace overview with ssh/pass
Various changes and moving stuff around.
This commit is contained in:
parent
072acf5ae3
commit
26305a7150
@ -40,7 +40,7 @@ function index()
|
||||
end
|
||||
page.index = true
|
||||
|
||||
entry({"admin", "index"}, form("admin/index"), "Overview", 1).ignoreindex = true
|
||||
entry({"admin", "index"}, cbi("admin/remote"), "Remotezugriff", 1).ignoreindex = true
|
||||
|
||||
if not configmode then
|
||||
entry({"admin", "logout"}, call("action_logout"), "Logout")
|
||||
|
@ -16,8 +16,7 @@ $Id$
|
||||
module("luci.controller.admin.upgrade", package.seeall)
|
||||
|
||||
function index()
|
||||
entry({"admin", "passwd"}, cbi("admin/passwd"), "Admin Password", 10)
|
||||
entry({"admin", "upgrade"}, call("action_upgrade"), "Flash Firmware", 90)
|
||||
entry({"admin", "upgrade"}, call("action_upgrade"), "Firmware aktualisieren", 90)
|
||||
end
|
||||
|
||||
function action_upgrade()
|
||||
|
@ -1,14 +0,0 @@
|
||||
--[[
|
||||
LuCI - Lua Configuration Interface
|
||||
|
||||
Copyright 2008 Steven Barth <steven@midlink.org>
|
||||
|
||||
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$
|
||||
]]--
|
||||
return Template("admin/index")
|
@ -18,9 +18,42 @@ local fs = require "nixio.fs"
|
||||
|
||||
local m, s, pw1, pw2
|
||||
|
||||
m = Map("system", "Passwort & SSH Keys")
|
||||
m = Map("system", "Remotezugriff")
|
||||
m.submit = "Speichern"
|
||||
m.reset = "Zurücksetzen"
|
||||
m.pageaction = false
|
||||
m.template = "admin/expertmode"
|
||||
|
||||
s = m:section(TypedSection, "Router Password",
|
||||
if fs.access("/etc/config/dropbear") then
|
||||
s = m:section(TypedSection, "_keys", nil,
|
||||
"Here you can paste public SSH-Keys (one per line) for SSH public-key authentication.")
|
||||
|
||||
s.addremove = false
|
||||
s.anonymous = true
|
||||
|
||||
function s.cfgsections()
|
||||
return { "_keys" }
|
||||
end
|
||||
|
||||
local keys
|
||||
|
||||
keys = s:option(TextValue, "_data", "")
|
||||
keys.wrap = "off"
|
||||
keys.rows = 5
|
||||
keys.rmempty = false
|
||||
|
||||
function keys.cfgvalue()
|
||||
return fs.readfile("/etc/dropbear/authorized_keys") or ""
|
||||
end
|
||||
|
||||
function keys.write(self, section, value)
|
||||
if value then
|
||||
fs.writefile("/etc/dropbear/authorized_keys", value:gsub("\r\n", "\n"))
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
s = m:section(TypedSection, "_pass", nil,
|
||||
"Changes the administrator password for accessing the device")
|
||||
|
||||
s.addremove = false
|
||||
@ -45,39 +78,10 @@ function m.on_commit(map)
|
||||
if luci.sys.user.setpasswd(luci.dispatcher.context.authuser, v1) == 0 then
|
||||
m.message = "Password successfully changed!"
|
||||
else
|
||||
m.message = "Unknown Error, password not changed!"
|
||||
m.errmessage = "Unknown Error, password not changed!"
|
||||
end
|
||||
else
|
||||
m.message = "Given password confirmation did not match, password not changed!"
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
if fs.access("/etc/config/dropbear") then
|
||||
s = m:section(TypedSection, "_keys", "SSH Keys",
|
||||
"Here you can paste public SSH-Keys (one per line) for SSH public-key authentication.")
|
||||
|
||||
s.addremove = false
|
||||
s.anonymous = true
|
||||
|
||||
function s.cfgsections()
|
||||
return { "_keys" }
|
||||
end
|
||||
|
||||
local keys
|
||||
|
||||
keys = s:option(TextValue, "_data", "")
|
||||
keys.wrap = "off"
|
||||
keys.rows = 3
|
||||
keys.rmempty = false
|
||||
|
||||
function keys.cfgvalue()
|
||||
return fs.readfile("/etc/dropbear/authorized_keys") or ""
|
||||
end
|
||||
|
||||
function keys.write(self, section, value)
|
||||
if value then
|
||||
fs.writefile("/etc/dropbear/authorized_keys", value:gsub("\r\n", "\n"))
|
||||
m.errmessage = "Given password confirmation did not match, password not changed!"
|
||||
end
|
||||
end
|
||||
end
|
@ -0,0 +1,57 @@
|
||||
<%- if self.message then %>
|
||||
<p class="message success"><%=self.message%></p>
|
||||
<%- end %>
|
||||
<%- if self.errmessage then %>
|
||||
<p class="message error"><%=self.errmessage%></p>
|
||||
<%- end %>
|
||||
<% if not self.embedded then %>
|
||||
<form method="post" enctype="multipart/form-data" action="<%=REQUEST_URI%>">
|
||||
<div>
|
||||
<script type="text/javascript" src="<%=resource%>/cbi.js"></script>
|
||||
<input type="hidden" name="cbi.submit" value="1" />
|
||||
</div>
|
||||
<% end %>
|
||||
<div class="cbi-map" id="cbi-<%=self.config%>">
|
||||
<% if self.title and #self.title > 0 then %><h2><a id="content" name="content"><%=self.title%></a></h2><% end %>
|
||||
<% if self.description and #self.description > 0 then %><div class="cbi-map-descr"><%=self.description%></div><% end %>
|
||||
<% self:render_children() %>
|
||||
<br />
|
||||
</div>
|
||||
<% if not self.embedded then %>
|
||||
<div class="cbi-page-actions">
|
||||
<%-
|
||||
if type(self.hidden) == "table" then
|
||||
for k, v in pairs(self.hidden) do
|
||||
-%>
|
||||
<input type="hidden" id="<%=k%>" name="<%=k%>" value="<%=pcdata(v)%>" />
|
||||
<%-
|
||||
end
|
||||
end
|
||||
%>
|
||||
<% if redirect then %>
|
||||
<div style="float:left">
|
||||
<input class="cbi-button cbi-button-link" type="button" value="<%:Back to Overview%>" onclick="location.href='<%=pcdata(redirect)%>'" />
|
||||
</div>
|
||||
<% end %>
|
||||
<%- if self.flow and self.flow.skip then %>
|
||||
<input class="cbi-button cbi-button-skip" type="submit" name="cbi.skip" value="<%:Skip%>" />
|
||||
<% end %>
|
||||
<%- if self.submit ~= false then %>
|
||||
<input class="cbi-button cbi-button-save" type="submit" name="cbi.apply" value="
|
||||
<%- if not self.submit then -%><%-:Submit-%><%-else-%><%=self.submit%><%end-%>
|
||||
" />
|
||||
<% end %>
|
||||
<%- if self.reset ~= false then %>
|
||||
<input class="cbi-button cbi-button-reset" type="reset" value="
|
||||
<%- if not self.reset then -%><%-:Reset-%><%-else-%><%=self.reset%><%end-%>
|
||||
" />
|
||||
<% end %>
|
||||
<%- if self.cancel ~= false and self.on_cancel then %>
|
||||
<input class="cbi-button cbi-button-reset" type="submit" name="cbi.cancel" value="
|
||||
<%- if not self.cancel then -%><%-:Cancel-%><%-else-%><%=self.cancel%><%end-%>
|
||||
" />
|
||||
<% end %>
|
||||
<script type="text/javascript">cbi_d_update();</script>
|
||||
</div>
|
||||
</form>
|
||||
<% end %>
|
@ -1,5 +0,0 @@
|
||||
<h2><a id="content" name="content">Hallo!</a></h2>
|
||||
<p>Dies ist der Experten-Modus deines Freifunkknotens.</p>
|
||||
<p>Hier kannst du weitere Einstellungen vornehmen, Firmware Upates
|
||||
einspielen und auch vieles kaputt machen.</p>
|
||||
<p>Sei bitte vorsichtig!</p>
|
Loading…
Reference in New Issue
Block a user