luci-base: luci.dispatcher: allow overriding sysauth template
In some cases it is useful to be able to override the template used for the sysauth login dialog. Add a new property "sysauth_template" which allows overriding the template name from controller files. Signed-off-by: Jo-Philipp Wich <jo@mein.io>
This commit is contained in:
parent
758555db1b
commit
57121f3743
1 changed files with 3 additions and 3 deletions
|
@ -101,7 +101,7 @@ function error500(message)
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
|
|
||||||
function authenticator.htmlauth(validator, accs, default)
|
function authenticator.htmlauth(validator, accs, default, template)
|
||||||
local user = http.formvalue("luci_username")
|
local user = http.formvalue("luci_username")
|
||||||
local pass = http.formvalue("luci_password")
|
local pass = http.formvalue("luci_password")
|
||||||
|
|
||||||
|
@ -113,7 +113,7 @@ function authenticator.htmlauth(validator, accs, default)
|
||||||
require("luci.template")
|
require("luci.template")
|
||||||
context.path = {}
|
context.path = {}
|
||||||
http.status(403, "Forbidden")
|
http.status(403, "Forbidden")
|
||||||
luci.template.render("sysauth", {duser=default, fuser=user})
|
luci.template.render(template or "sysauth", {duser=default, fuser=user})
|
||||||
|
|
||||||
return false
|
return false
|
||||||
|
|
||||||
|
@ -360,7 +360,7 @@ function dispatch(request)
|
||||||
|
|
||||||
if not util.contains(accs, user) then
|
if not util.contains(accs, user) then
|
||||||
if authen then
|
if authen then
|
||||||
local user, sess = authen(sys.user.checkpasswd, accs, def)
|
local user, sess = authen(sys.user.checkpasswd, accs, def, track.sysauth_template)
|
||||||
local token
|
local token
|
||||||
if not user or not util.contains(accs, user) then
|
if not user or not util.contains(accs, user) then
|
||||||
return
|
return
|
||||||
|
|
Loading…
Reference in a new issue