libs/web: adapt dispatcher to sauth api changes
This commit is contained in:
parent
abef50b852
commit
7bca24db1b
1 changed files with 3 additions and 5 deletions
|
@ -352,9 +352,6 @@ function dispatch(request)
|
||||||
local user
|
local user
|
||||||
|
|
||||||
if sdat then
|
if sdat then
|
||||||
sdat = loadstring(sdat)
|
|
||||||
setfenv(sdat, {})
|
|
||||||
sdat = sdat()
|
|
||||||
if not verifytoken or ctx.urltoken.stok == sdat.token then
|
if not verifytoken or ctx.urltoken.stok == sdat.token then
|
||||||
user = sdat.user
|
user = sdat.user
|
||||||
end
|
end
|
||||||
|
@ -376,11 +373,12 @@ function dispatch(request)
|
||||||
local sid = sess or luci.sys.uniqueid(16)
|
local sid = sess or luci.sys.uniqueid(16)
|
||||||
if not sess then
|
if not sess then
|
||||||
local token = luci.sys.uniqueid(16)
|
local token = luci.sys.uniqueid(16)
|
||||||
sauth.write(sid, util.get_bytecode({
|
sauth.reap()
|
||||||
|
sauth.write(sid, {
|
||||||
user=user,
|
user=user,
|
||||||
token=token,
|
token=token,
|
||||||
secret=luci.sys.uniqueid(16)
|
secret=luci.sys.uniqueid(16)
|
||||||
}))
|
})
|
||||||
ctx.urltoken.stok = token
|
ctx.urltoken.stok = token
|
||||||
end
|
end
|
||||||
luci.http.header("Set-Cookie", "sysauth=" .. sid.."; path="..build_url())
|
luci.http.header("Set-Cookie", "sysauth=" .. sid.."; path="..build_url())
|
||||||
|
|
Loading…
Reference in a new issue