summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorKarl Palsson <karlp@etactica.com>2020-06-30 15:40:52 +0000
committerJo-Philipp Wich <jo@mein.io>2020-06-30 17:43:39 +0200
commit8f9433127e5d2a576a1207da46d02389b82041a5 (patch)
treea7b9dc494c33187b178fefcb7610515e392aec5c
parent1f89ee8ed0660d447056439e884684a5e02a7432 (diff)
luci-base: allow themes to provide sysauth.htm
Support for sysauth_template was (inadvertently) dropped in refactorings to support the json menu construction. This does not restore that functionality, which allowed different templates for every node in the dispatcher tree, but provides an alternative mechanism that allows a theme to provide a sysauth.htm template file instead. Tested-by: Karl Palsson <karlp@etactica.com> Signed-off-by: Jo-Philipp Wich <jo@mein.io>
-rw-r--r--modules/luci-base/luasrc/dispatcher.lua7
1 files changed, 6 insertions, 1 deletions
diff --git a/modules/luci-base/luasrc/dispatcher.lua b/modules/luci-base/luasrc/dispatcher.lua
index d2552d6db4..57b4e12d17 100644
--- a/modules/luci-base/luasrc/dispatcher.lua
+++ b/modules/luci-base/luasrc/dispatcher.lua
@@ -884,7 +884,12 @@ function dispatch(request)
http.status(403, "Forbidden")
http.header("X-LuCI-Login-Required", "yes")
- return tpl.render("sysauth", { duser = "root", fuser = user })
+ local scope = { duser = "root", fuser = user }
+ local ok, res = util.copcall(tpl.render_string, [[<% include("themes/" .. theme .. "/sysauth") %>]], scope)
+ if ok then
+ return res
+ end
+ return tpl.render("sysauth", scope)
end
http.header("Set-Cookie", 'sysauth=%s; path=%s; SameSite=Strict; HttpOnly%s' %{