modules/rpc: adapt rpc controller to sauth api changes

This commit is contained in:
Jo-Philipp Wich 2012-08-08 09:48:53 +00:00
parent 7bca24db1b
commit c8ffc897e3

View file

@ -27,9 +27,8 @@ function index()
if auth then -- if authentication token was given
local sdat = luci.sauth.read(auth)
if sdat then -- if given token is valid
user = luci.sauth.decode(sdat).user
if user and luci.util.contains(accs, user) then
return user, auth
if sdat.user and luci.util.contains(accs, sdat.user) then
return sdat.user, auth
end
end
end
@ -68,11 +67,12 @@ function rpc_auth()
secret = sys.uniqueid(16)
http.header("Set-Cookie", "sysauth=" .. sid.."; path=/")
sauth.write(sid, sauth.encode({
sauth.reap()
sauth.write(sid, {
user=user,
token=token,
secret=secret
}))
})
end
return sid and {sid=sid, token=token, secret=secret}