* libs/web: Added Logout support
authorSteven Barth <steven@midlink.org>
Sun, 29 Jun 2008 14:43:06 +0000 (14:43 +0000)
committerSteven Barth <steven@midlink.org>
Sun, 29 Jun 2008 14:43:06 +0000 (14:43 +0000)
* libs/web: Fixed a bug with an invalid calling convention in luci.dispatcher
* libs/sys: Fixed rudimentary posix.crypt detection

i18n/english/luasrc/i18n/default.en.lua
i18n/german/luasrc/i18n/default.de.lua
libs/core/luasrc/sys.lua
libs/web/luasrc/dispatcher.lua
modules/admin-core/luasrc/controller/admin/index.lua

index 593c11ea3c0d46845b84689a927545e024601258..df135a66d8020ad85376952b907646c31f3d0d6a 100644 (file)
@@ -40,6 +40,7 @@ ipaddress = "IP-Address"
 
 legend = "Legend"
 library = "Library"
+logout = "Logout"
 
 key = "Key"
 
index 0eec9cf8333b09e25c4546ca1743c0cfad6a6184..4e0a36f66c52eabe4ce629734fe43aac4b6a17e2 100644 (file)
@@ -42,6 +42,7 @@ legend = "Legende"
 library = "Bibliothek"
 load = "Last"
 login = "Anmelden"
+logout = "Abmelden"
 
 key = "Schlüssel"
 
index c5c471a75fee5bb9262cdda1e4059c806a54ed36..e5f19f20b82b51eca87a0b5cffaeb921c1710144 100644 (file)
@@ -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
index 7c28f6a78eef14ff31b39de8fd02ec24fcd81299..689d060d528273a5227c69362b09e46f76b58ca5 100644 (file)
@@ -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
        
index 93d2e4787580d79cc4bf86575b34683a46a55705..eb58e00422932d43ec786db5beebf77611c65141 100644 (file)
@@ -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