RPC initial authentication API completed
[project/luci.git] / libs / web / luasrc / dispatcher.lua
index 2de5ea4..068f350 100644 (file)
@@ -79,7 +79,7 @@ function error500(message)
        return false
 end
 
-function authenticator.htmlauth(validator, default)
+function authenticator.htmlauth(validator, accs, default)
        local user = luci.http.formvalue("username")
        local pass = luci.http.formvalue("password")
        
@@ -125,18 +125,23 @@ function dispatch(request)
        local c = context.tree
        local track = {}
        local args = {}
+       context.args = args
        local n
 
        for i, s in ipairs(request) do
                c = c.nodes[s]
                n = i
-               if not c or c.leaf then
+               if not c then
                        break
                end
 
                for k, v in pairs(c) do
                        track[k] = v
                end
+               
+               if c.leaf then
+                       break
+               end
        end
 
        if c and c.leaf then
@@ -182,7 +187,7 @@ function dispatch(request)
                
                if not luci.util.contains(accs, user) then
                        if authen then
-                               local user = authen(luci.sys.user.checkpasswd, def)
+                               local user = authen(luci.sys.user.checkpasswd, accs, def)
                                if not user or not luci.util.contains(accs, user) then
                                        return
                                else