|
Revision 6719, 1.2 KB
(checked in by jow, 2 years ago)
|
|
modules/admin-full: make logout a toplevel item, remove overview menu
|
-
Property svn:keywords set to
Id
|
| Line | |
|---|
| 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 | module("luci.controller.admin.index", package.seeall) |
|---|
| 15 | |
|---|
| 16 | function index() |
|---|
| 17 | luci.i18n.loadc("base") |
|---|
| 18 | local i18n = luci.i18n.translate |
|---|
| 19 | |
|---|
| 20 | local root = node() |
|---|
| 21 | if not root.target then |
|---|
| 22 | root.target = alias("admin") |
|---|
| 23 | root.index = true |
|---|
| 24 | end |
|---|
| 25 | |
|---|
| 26 | local page = node("admin") |
|---|
| 27 | page.target = alias("admin", "status") |
|---|
| 28 | page.title = i18n("Administration") |
|---|
| 29 | page.order = 10 |
|---|
| 30 | page.sysauth = "root" |
|---|
| 31 | page.sysauth_authenticator = "htmlauth" |
|---|
| 32 | page.ucidata = true |
|---|
| 33 | page.index = true |
|---|
| 34 | |
|---|
| 35 | entry({"admin", "logout"}, call("action_logout"), i18n("Logout"), 90) |
|---|
| 36 | end |
|---|
| 37 | |
|---|
| 38 | function action_logout() |
|---|
| 39 | local dsp = require "luci.dispatcher" |
|---|
| 40 | local sauth = require "luci.sauth" |
|---|
| 41 | if dsp.context.authsession then |
|---|
| 42 | sauth.kill(dsp.context.authsession) |
|---|
| 43 | dsp.context.urltoken.stok = nil |
|---|
| 44 | end |
|---|
| 45 | |
|---|
| 46 | luci.http.header("Set-Cookie", "sysauth=; path=" .. dsp.build_url()) |
|---|
| 47 | luci.http.redirect(luci.dispatcher.build_url()) |
|---|
| 48 | end |
|---|