2015-01-16 22:38:38 +00:00
|
|
|
-- Copyright 2008 Steven Barth <steven@midlink.org>
|
2015-01-16 22:46:42 +00:00
|
|
|
-- Copyright 2008 Jo-Philipp Wich <jow@openwrt.org>
|
2015-01-16 22:38:38 +00:00
|
|
|
-- Licensed to the public under the Apache License 2.0.
|
2008-07-15 14:33:29 +00:00
|
|
|
|
|
|
|
module("luci.controller.mini.index", package.seeall)
|
2008-05-22 14:04:03 +00:00
|
|
|
|
|
|
|
function index()
|
|
|
|
local root = node()
|
2008-07-15 14:33:29 +00:00
|
|
|
if not root.lock then
|
|
|
|
root.target = alias("mini")
|
2008-10-09 20:28:07 +00:00
|
|
|
root.index = true
|
2008-05-22 14:04:03 +00:00
|
|
|
end
|
|
|
|
|
2009-11-01 14:24:04 +00:00
|
|
|
entry({"about"}, template("about"))
|
2008-05-28 21:02:52 +00:00
|
|
|
|
2011-08-12 13:16:27 +00:00
|
|
|
local page = entry({"mini"}, alias("mini", "index"), _("Essentials"), 10)
|
2008-06-02 17:49:27 +00:00
|
|
|
page.sysauth = "root"
|
2008-08-10 12:58:05 +00:00
|
|
|
page.sysauth_authenticator = "htmlauth"
|
2008-10-09 20:28:07 +00:00
|
|
|
page.index = true
|
2008-05-22 14:04:03 +00:00
|
|
|
|
2011-08-12 13:16:27 +00:00
|
|
|
entry({"mini", "index"}, alias("mini", "index", "index"), _("Overview"), 10).index = true
|
|
|
|
entry({"mini", "index", "index"}, form("mini/index"), _("General"), 1).ignoreindex = true
|
|
|
|
entry({"mini", "index", "luci"}, cbi("mini/luci", {autoapply=true}), _("Settings"), 10)
|
|
|
|
entry({"mini", "index", "logout"}, call("action_logout"), _("Logout"))
|
2008-06-29 14:43:06 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
function action_logout()
|
2008-12-14 21:43:05 +00:00
|
|
|
local dsp = require "luci.dispatcher"
|
2015-01-15 09:55:53 +00:00
|
|
|
local utl = require "luci.util"
|
2008-12-14 21:43:05 +00:00
|
|
|
if dsp.context.authsession then
|
2015-01-15 09:55:53 +00:00
|
|
|
utl.ubus("session", "destroy", {
|
|
|
|
ubus_rpc_session = dsp.context.authsession
|
|
|
|
})
|
2008-12-15 10:40:45 +00:00
|
|
|
dsp.context.urltoken.stok = nil
|
2008-12-14 21:43:05 +00:00
|
|
|
end
|
|
|
|
|
2008-12-15 10:40:45 +00:00
|
|
|
luci.http.header("Set-Cookie", "sysauth=; path=" .. dsp.build_url())
|
2008-06-29 14:43:06 +00:00
|
|
|
luci.http.redirect(luci.dispatcher.build_url())
|
2009-11-01 14:24:04 +00:00
|
|
|
end
|