diff options
Diffstat (limited to 'modules/luci-base/luasrc/dispatcher.lua')
-rw-r--r-- | modules/luci-base/luasrc/dispatcher.lua | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/modules/luci-base/luasrc/dispatcher.lua b/modules/luci-base/luasrc/dispatcher.lua index e286430765..a3726fb1c1 100644 --- a/modules/luci-base/luasrc/dispatcher.lua +++ b/modules/luci-base/luasrc/dispatcher.lua @@ -39,6 +39,10 @@ local function check_fs_depends(spec) if fs.stat(path, "type") ~= "reg" then return false end + elseif kind == "absent" then + if fs.stat(path, "type") then + return false + end end end @@ -339,12 +343,12 @@ local function tree_to_json(node, json) if subnode.sysauth_authenticator == "htmlauth" then spec.auth = { login = true, - methods = { "cookie:sysauth" } + methods = { "cookie:sysauth_https", "cookie:sysauth_http" } } elseif subname == "rpc" and subnode.module == "luci.controller.rpc" then spec.auth = { login = false, - methods = { "query:auth", "cookie:sysauth" } + methods = { "query:auth", "cookie:sysauth_https", "cookie:sysauth_http" } } elseif subnode.module == "luci.controller.admin.uci" then spec.auth = { @@ -728,7 +732,7 @@ local function init_template_engine(ctx) return tpl end -local function is_authenticated(auth) +function is_authenticated(auth) if type(auth) == "table" and type(auth.methods) == "table" and #auth.methods > 0 then local sid, sdat, sacl for _, method in ipairs(auth.methods) do @@ -925,7 +929,8 @@ function dispatch(request) return tpl.render("sysauth", scope) end - http.header("Set-Cookie", 'sysauth=%s; path=%s; SameSite=Strict; HttpOnly%s' %{ + http.header("Set-Cookie", 'sysauth_%s=%s; path=%s; SameSite=Strict; HttpOnly%s' %{ + http.getenv("HTTPS") == "on" and "https" or "http", sid, build_url(), http.getenv("HTTPS") == "on" and "; secure" or "" }) |