Always redirect somewhere on captive success, instead of displaying an empty page

This commit is contained in:
Alfredo Cardigliano 2023-10-23 16:27:46 +02:00
parent 181f8a8178
commit 2a37337a9c
2 changed files with 11 additions and 3 deletions

View file

@ -20,15 +20,21 @@ local redirection_url = ntop.getPref("ntopng.prefs.redirection_url")
if isEmptyString(redirection_url) then
-- Redirect to the original URL
redirection_url = _GET["referer"]
end
if not isEmptyString(redirection_url) and not starts(redirection_url, "http") then
redirection_url = "http://" .. redirection_url
end
if isEmptyString(redirection_url) then
-- Last resort, using www.ntop.org
redirection_url = "www.ntop.org"
end
if not isEmptyString(redirection_url) then
if not starts(redirection_url, "http") then
redirection_url = "http://" .. redirection_url
end
print('<meta http-equiv="refresh" Content="0; url='..redirection_url..'"/>')
end
print [[
</head>
<body>