diff options
author | Steven Barth <steven@midlink.org> | 2008-06-29 14:43:06 +0000 |
---|---|---|
committer | Steven Barth <steven@midlink.org> | 2008-06-29 14:43:06 +0000 |
commit | b8240f3516945b5969bfcfeb1fcc057759f5dd4b (patch) | |
tree | 75bc66ea10609d4b11981d8ab88e2c335e7357a6 | |
parent | ee324cb3a70d39dc9522a1ee63af12137d433533 (diff) |
* libs/web: Added Logout support
* libs/web: Fixed a bug with an invalid calling convention in luci.dispatcher
* libs/sys: Fixed rudimentary posix.crypt detection
-rw-r--r-- | i18n/english/luasrc/i18n/default.en.lua | 1 | ||||
-rw-r--r-- | i18n/german/luasrc/i18n/default.de.lua | 1 | ||||
-rw-r--r-- | libs/core/luasrc/sys.lua | 2 | ||||
-rw-r--r-- | libs/web/luasrc/dispatcher.lua | 4 | ||||
-rw-r--r-- | modules/admin-core/luasrc/controller/admin/index.lua | 7 |
5 files changed, 11 insertions, 4 deletions
diff --git a/i18n/english/luasrc/i18n/default.en.lua b/i18n/english/luasrc/i18n/default.en.lua index 593c11ea3..df135a66d 100644 --- a/i18n/english/luasrc/i18n/default.en.lua +++ b/i18n/english/luasrc/i18n/default.en.lua @@ -40,6 +40,7 @@ ipaddress = "IP-Address" legend = "Legend" library = "Library" +logout = "Logout" key = "Key" diff --git a/i18n/german/luasrc/i18n/default.de.lua b/i18n/german/luasrc/i18n/default.de.lua index 0eec9cf83..4e0a36f66 100644 --- a/i18n/german/luasrc/i18n/default.de.lua +++ b/i18n/german/luasrc/i18n/default.de.lua @@ -42,6 +42,7 @@ legend = "Legende" library = "Bibliothek" load = "Last" login = "Anmelden" +logout = "Abmelden" key = "Schlüssel" diff --git a/libs/core/luasrc/sys.lua b/libs/core/luasrc/sys.lua index c5c471a75..e5f19f20b 100644 --- a/libs/core/luasrc/sys.lua +++ b/libs/core/luasrc/sys.lua @@ -289,7 +289,7 @@ function user.checkpasswd(username, password) local account = user.getuser(username) -- FIXME: detect testing environment - if luci.fs.isfile("/etc/shadow") and not luci.fs.access("/etc/shadow", "r") then + if luci.fs.stat("/etc/shadow") and not luci.fs.access("/etc/shadow", "r") then return true elseif account then if account.passwd == "!" then diff --git a/libs/web/luasrc/dispatcher.lua b/libs/web/luasrc/dispatcher.lua index 7c28f6a78..689d060d5 100644 --- a/libs/web/luasrc/dispatcher.lua +++ b/libs/web/luasrc/dispatcher.lua @@ -75,7 +75,7 @@ function sysauth(default) if user and luci.sys.user.checkpasswd(user, pass) then local sid = luci.sys.uniqueid(16) - luci.http.header("Set-Cookie", "sysauth=" .. sid) + luci.http.header("Set-Cookie", "sysauth=" .. sid.."; path=/") luci.sauth.write(sid, user) return true else @@ -291,7 +291,7 @@ end -- Reassigns a node to another position function assign(path, clone, title, order) - local obj = node(path) + local obj = node(unpack(path)) obj.nodes = nil obj.module = nil diff --git a/modules/admin-core/luasrc/controller/admin/index.lua b/modules/admin-core/luasrc/controller/admin/index.lua index 93d2e4787..eb58e0042 100644 --- a/modules/admin-core/luasrc/controller/admin/index.lua +++ b/modules/admin-core/luasrc/controller/admin/index.lua @@ -40,5 +40,10 @@ function index() page.target = cbi("admin_index/luci") page.title = i18n("a_i_ui", "Oberfläche") - + entry({"admin", "logout"}, call("action_logout"), i18n("logout")) +end + +function action_logout() + luci.http.header("Set-Cookie", "sysauth=; path=/") + luci.http.redirect(luci.dispatcher.build_url()) end
\ No newline at end of file |