summaryrefslogtreecommitdiffhomepage
path: root/libs/web/luasrc/dispatcher.lua
diff options
context:
space:
mode:
authorSteven Barth <steven@midlink.org>2008-08-26 00:53:28 +0000
committerSteven Barth <steven@midlink.org>2008-08-26 00:53:28 +0000
commit0c5dc7bc77a4fd7d7f0d965e3185e2df4c608f05 (patch)
treeb6a3a5fd860f43a171ebdb4446974489f4dbbb0b /libs/web/luasrc/dispatcher.lua
parent8e6d1e682afee81fb4199ad494195c23e4381af5 (diff)
libs/core: Reworked some basic libraries to not use package.seeall
libs/json: Implemented own JSON-Decoder (Encoder will follow) modules/rpc: Preliminary implemented RPC-Exports for luci.fs, luci.sys and luci.model.uci
Diffstat (limited to 'libs/web/luasrc/dispatcher.lua')
-rw-r--r--libs/web/luasrc/dispatcher.lua8
1 files changed, 5 insertions, 3 deletions
diff --git a/libs/web/luasrc/dispatcher.lua b/libs/web/luasrc/dispatcher.lua
index 3ee42d72bb..3cfa6c7044 100644
--- a/libs/web/luasrc/dispatcher.lua
+++ b/libs/web/luasrc/dispatcher.lua
@@ -187,13 +187,15 @@ function dispatch(request)
if not luci.util.contains(accs, user) then
if authen then
- local user = authen(luci.sys.user.checkpasswd, accs, def)
+ local user, sess = authen(luci.sys.user.checkpasswd, accs, def)
if not user or not luci.util.contains(accs, user) then
return
else
- local sid = luci.sys.uniqueid(16)
+ local sid = sess or luci.sys.uniqueid(16)
luci.http.header("Set-Cookie", "sysauth=" .. sid.."; path=/")
- luci.sauth.write(sid, user)
+ if not sess then
+ luci.sauth.write(sid, user)
+ end
end
else
luci.http.status(403, "Forbidden")