applications, modules: remove i18n handling from controller modules as it moved to...
[project/luci.git] / modules / admin-full / luasrc / controller / admin / index.lua
1 --[[
2 LuCI - Lua Configuration Interface
3
4 Copyright 2008 Steven Barth <steven@midlink.org>
5
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
9
10 http://www.apache.org/licenses/LICENSE-2.0
11
12 $Id$
13 ]]--
14
15 module("luci.controller.admin.index", package.seeall)
16
17 function index()
18 local root = node()
19 if not root.target then
20 root.target = alias("admin")
21 root.index = true
22 end
23
24 local page = node("admin")
25 page.target = alias("admin", "status")
26 page.title = _("Administration")
27 page.order = 10
28 page.sysauth = "root"
29 page.sysauth_authenticator = "htmlauth"
30 page.ucidata = true
31 page.index = true
32
33 entry({"admin", "logout"}, call("action_logout"), _("Logout"), 90)
34 end
35
36 function action_logout()
37 local dsp = require "luci.dispatcher"
38 local sauth = require "luci.sauth"
39 if dsp.context.authsession then
40 sauth.kill(dsp.context.authsession)
41 dsp.context.urltoken.stok = nil
42 end
43
44 luci.http.header("Set-Cookie", "sysauth=; path=" .. dsp.build_url())
45 luci.http.redirect(luci.dispatcher.build_url())
46 end