* 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
This commit is contained in:
parent
ee324cb3a7
commit
b8240f3516
5 changed files with 11 additions and 4 deletions
|
@ -40,6 +40,7 @@ ipaddress = "IP-Address"
|
||||||
|
|
||||||
legend = "Legend"
|
legend = "Legend"
|
||||||
library = "Library"
|
library = "Library"
|
||||||
|
logout = "Logout"
|
||||||
|
|
||||||
key = "Key"
|
key = "Key"
|
||||||
|
|
||||||
|
|
|
@ -42,6 +42,7 @@ legend = "Legende"
|
||||||
library = "Bibliothek"
|
library = "Bibliothek"
|
||||||
load = "Last"
|
load = "Last"
|
||||||
login = "Anmelden"
|
login = "Anmelden"
|
||||||
|
logout = "Abmelden"
|
||||||
|
|
||||||
key = "Schlüssel"
|
key = "Schlüssel"
|
||||||
|
|
||||||
|
|
|
@ -289,7 +289,7 @@ function user.checkpasswd(username, password)
|
||||||
local account = user.getuser(username)
|
local account = user.getuser(username)
|
||||||
|
|
||||||
-- FIXME: detect testing environment
|
-- 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
|
return true
|
||||||
elseif account then
|
elseif account then
|
||||||
if account.passwd == "!" then
|
if account.passwd == "!" then
|
||||||
|
|
|
@ -75,7 +75,7 @@ function sysauth(default)
|
||||||
|
|
||||||
if user and luci.sys.user.checkpasswd(user, pass) then
|
if user and luci.sys.user.checkpasswd(user, pass) then
|
||||||
local sid = luci.sys.uniqueid(16)
|
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)
|
luci.sauth.write(sid, user)
|
||||||
return true
|
return true
|
||||||
else
|
else
|
||||||
|
@ -291,7 +291,7 @@ end
|
||||||
|
|
||||||
-- Reassigns a node to another position
|
-- Reassigns a node to another position
|
||||||
function assign(path, clone, title, order)
|
function assign(path, clone, title, order)
|
||||||
local obj = node(path)
|
local obj = node(unpack(path))
|
||||||
obj.nodes = nil
|
obj.nodes = nil
|
||||||
obj.module = nil
|
obj.module = nil
|
||||||
|
|
||||||
|
|
|
@ -40,5 +40,10 @@ function index()
|
||||||
page.target = cbi("admin_index/luci")
|
page.target = cbi("admin_index/luci")
|
||||||
page.title = i18n("a_i_ui", "Oberfläche")
|
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
|
end
|
Loading…
Reference in a new issue