2 LuCI - Lua Configuration Interface
4 Copyright 2008 Steven Barth <steven@midlink.org>
6 Licensed under the Apache License, Version 2.0 (the "License");
7 you may not use this file except in compliance with the License.
8 You may obtain a copy of the License at
10 http://www.apache.org/licenses/LICENSE-2.0
15 module("luci.controller.admin.index", package.seeall)
19 if not root.target then
20 root.target = alias("admin")
24 local page = node("admin")
25 page.target = firstchild()
26 page.title = _("Administration")
29 page.sysauth_authenticator = "htmlauth"
33 -- Empty services menu to be populated by addons
34 entry({"admin", "services"}, firstchild(), _("Services"), 40).index = true
36 entry({"admin", "logout"}, call("action_logout"), _("Logout"), 90)
39 function action_logout()
40 local dsp = require "luci.dispatcher"
41 local utl = require "luci.util"
42 if dsp.context.authsession then
43 utl.ubus("session", "destroy", {
44 ubus_rpc_session = dsp.context.authsession
46 dsp.context.urltoken.stok = nil
49 luci.http.header("Set-Cookie", "sysauth=; path=" .. dsp.build_url())
50 luci.http.redirect(luci.dispatcher.build_url())