modules/rpc: adapt rpc controller to sauth api changes
This commit is contained in:
parent
7bca24db1b
commit
c8ffc897e3
1 changed files with 15 additions and 15 deletions
|
@ -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}
|
||||
|
|
Loading…
Reference in a new issue