luci/modules/admin-mini/luasrc/controller/mini/index.lua

52 lines
1.5 KiB
Lua
Raw Normal View History

--[[
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$
]]--
module("luci.controller.mini.index", package.seeall)
2008-05-22 14:04:03 +00:00
function index()
luci.i18n.loadc("base")
local i18n = luci.i18n.translate
2008-05-22 14:04:03 +00:00
local root = node()
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
entry({"about"}, template("about"))
2008-05-28 21:02:52 +00:00
local page = entry({"mini"}, alias("mini", "index"), i18n("Essentials"), 10)
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
entry({"mini", "index"}, alias("mini", "index", "index"), i18n("Overview"), 10).index = true
entry({"mini", "index", "index"}, form("mini/index"), i18n("General"), 1).ignoreindex = true
entry({"mini", "index", "luci"}, cbi("mini/luci", {autoapply=true}), i18n("Settings"), 10)
entry({"mini", "index", "logout"}, call("action_logout"), i18n("Logout"))
end
function action_logout()
2008-12-14 21:43:05 +00:00
local dsp = require "luci.dispatcher"
local sauth = require "luci.sauth"
if dsp.context.authsession then
sauth.kill(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())
luci.http.redirect(luci.dispatcher.build_url())
end