Fix HTTPS link on login page (#2729)

This commit is contained in:
DL6ER
2023-10-08 18:13:41 +02:00
committed by GitHub
2 changed files with 7 additions and 10 deletions
+1 -10
View File
@@ -8,15 +8,6 @@
--]]
mg.include('scripts/pi-hole/lua/header.lp','r')
-- Build HTTPS upgrade link if HTTP is used
https_link = ""
if not is_secure then
https_link = "https://pi.hole" .. mg.request_info.request_uri
if mg.request_info.query_string then
https_link = https_link .. "?" .. mg.request_info.query_string
end
end
?>
<body class="hold-transition layout-boxed login-page">
<div class="box login-box" id="login-box">
@@ -41,7 +32,7 @@ end
<h3 class="box-title has-error control-label"><i class="fa fa-fw fa-triangle-exclamation"></i>&nbsp;&nbsp;Insecure network connection&nbsp;&nbsp;<i class="fa fa-fw fa-triangle-exclamation"></i></h3>
</div>
<div class="box-body">
<p>Consider upgrading to <a href="<?=https_link?>">HTTPS</a> (end-to-end encryption)</p>
<p>Consider upgrading to <a href="#" id="https-link">HTTPS</a> (end-to-end encryption)</p>
</div>
</div>
</div>
+6
View File
@@ -117,4 +117,10 @@ $(function () {
// Clear TOTP field
$("#totp").val("");
// Generate HTTPS redirection link (only used if not already HTTPS)
if (location.protocol !== "https:") {
const url = "https:" + location.href.substring(location.protocol.length);
$("#https-link").attr("href", url);
}
});