mirror of
https://github.com/pi-hole/web.git
synced 2024-12-06 19:36:21 +01:00
Build HTTPS URL using Javascript to ensure we use the exact same URL the user used to get there - do not hard-code pi.hole as hostname
Signed-off-by: DL6ER <dl6er@dl6er.de>
This commit is contained in:
@@ -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> Insecure network connection <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>
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user