X-Git-Url: http://git.archive.openwrt.org/?p=project%2Fluci.git;a=blobdiff_plain;f=modules%2Frpc%2Fluasrc%2Fcontroller%2Frpc.lua;h=6b091163f129a7ec12ef3ecf8f2e25e9e52b8567;hp=7255c1780a2239dd3db045a6abec57c6738c4c93;hb=69aa218335330e1e8c623fdc2e5e336b2b78056f;hpb=0c4edd49b982007fff60f64a86d73aabf7f68784 diff --git a/modules/rpc/luasrc/controller/rpc.lua b/modules/rpc/luasrc/controller/rpc.lua index 7255c1780..6b091163f 100644 --- a/modules/rpc/luasrc/controller/rpc.lua +++ b/modules/rpc/luasrc/controller/rpc.lua @@ -24,11 +24,13 @@ module "luci.controller.rpc" function index() local function authenticator(validator, accs) local auth = luci.http.formvalue("auth", true) - if auth then + if auth then -- if authentication token was given local sdat = luci.sauth.read(auth) - user = loadstring(sdat)().user - if user and luci.util.contains(accs, user) then - return user, auth + if sdat then -- if given token is valid + user = loadstring(sdat)().user + if user and luci.util.contains(accs, user) then + return user, auth + end end end luci.http.status(403, "Forbidden")