luci-base: use local sys module table in luci.dispatcher
Signed-off-by: Jo-Philipp Wich <jow@openwrt.org>
This commit is contained in:
parent
daee4a650e
commit
2ebc394347
1 changed files with 6 additions and 6 deletions
|
@ -357,7 +357,7 @@ function dispatch(request)
|
||||||
else
|
else
|
||||||
local eu = http.getenv("HTTP_AUTH_USER")
|
local eu = http.getenv("HTTP_AUTH_USER")
|
||||||
local ep = http.getenv("HTTP_AUTH_PASS")
|
local ep = http.getenv("HTTP_AUTH_PASS")
|
||||||
if eu and ep and luci.sys.user.checkpasswd(eu, ep) then
|
if eu and ep and sys.user.checkpasswd(eu, ep) then
|
||||||
authen = function() return eu end
|
authen = function() return eu end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -365,20 +365,20 @@ function dispatch(request)
|
||||||
if not util.contains(accs, user) then
|
if not util.contains(accs, user) then
|
||||||
if authen then
|
if authen then
|
||||||
ctx.urltoken.stok = nil
|
ctx.urltoken.stok = nil
|
||||||
local user, sess = authen(luci.sys.user.checkpasswd, accs, def)
|
local user, sess = authen(sys.user.checkpasswd, accs, def)
|
||||||
if not user or not util.contains(accs, user) then
|
if not user or not util.contains(accs, user) then
|
||||||
return
|
return
|
||||||
else
|
else
|
||||||
if not sess then
|
if not sess then
|
||||||
local sdat = util.ubus("session", "create", { timeout = luci.config.sauth.sessiontime })
|
local sdat = util.ubus("session", "create", { timeout = luci.config.sauth.sessiontime })
|
||||||
if sdat then
|
if sdat then
|
||||||
local token = luci.sys.uniqueid(16)
|
local token = sys.uniqueid(16)
|
||||||
util.ubus("session", "set", {
|
util.ubus("session", "set", {
|
||||||
ubus_rpc_session = sdat.ubus_rpc_session,
|
ubus_rpc_session = sdat.ubus_rpc_session,
|
||||||
values = {
|
values = {
|
||||||
user = user,
|
user = user,
|
||||||
token = token,
|
token = token,
|
||||||
section = luci.sys.uniqueid(16)
|
section = sys.uniqueid(16)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
sess = sdat.ubus_rpc_session
|
sess = sdat.ubus_rpc_session
|
||||||
|
@ -403,11 +403,11 @@ function dispatch(request)
|
||||||
end
|
end
|
||||||
|
|
||||||
if track.setgroup then
|
if track.setgroup then
|
||||||
luci.sys.process.setgroup(track.setgroup)
|
sys.process.setgroup(track.setgroup)
|
||||||
end
|
end
|
||||||
|
|
||||||
if track.setuser then
|
if track.setuser then
|
||||||
luci.sys.process.setuser(track.setuser)
|
sys.process.setuser(track.setuser)
|
||||||
end
|
end
|
||||||
|
|
||||||
local target = nil
|
local target = nil
|
||||||
|
|
Loading…
Reference in a new issue