diff --git a/login.lp b/login.lp
index 8d4b4bda..30e002b1 100644
--- a/login.lp
+++ b/login.lp
@@ -26,8 +26,8 @@ mg.include('scripts/pi-hole/lua/header.lp','r')
-
-
+
+
diff --git a/scripts/pi-hole/js/login.js b/scripts/pi-hole/js/login.js
index b394dd95..3f402841 100644
--- a/scripts/pi-hole/js/login.js
+++ b/scripts/pi-hole/js/login.js
@@ -112,15 +112,25 @@ $(function () {
}).done(function (data) {
if (data.session.valid === true) redirect();
if (data.session.totp === true) $("#totp_input").removeClass("hidden");
+ });
+
+ // Get information about HTTPS port and DNS status
+ $.ajax({
+ url: "/api/info/login",
+ }).done(function (data) {
if (data.dns === false) showDNSfailure();
+
+ // Generate HTTPS redirection link (only used if not already HTTPS)
+ if (location.protocol !== "https:" && data.https_port !== 0) {
+ let url = "https://" + location.hostname;
+ if (data.https_port !== 443) url += ":" + data.https_port;
+ url += location.pathname + location.search + location.hash;
+
+ $("#https-link").attr("href", url);
+ $("#insecure-box").show();
+ }
});
// 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);
- }
});