(function () {
try {
const path = (location.pathname || "").toLowerCase();
const state = (document.body.getAttribute("data-sitemap-state") || "").toLowerCase();
const isSignIn =
path.includes("/signin") ||
path.includes("/sign-in") ||
state.includes("/access-denied/") ||
state.includes("/signin");
console.log("[CustomSigninScripts] executed ✅", { path, state, isSignIn });
if (!isSignIn) return;
function injectHero() {
// Find the REAL provider button (this is what we will click)
const providerBtn =
document.querySelector('button[name="provider"][type="submit"]') ||
document.querySelector('button[name="provider"]');
if (!providerBtn) {
console.log("[CustomSigninScripts] provider button not found yet…");
return false;
}
// Avoid double inject
if (document.querySelector(".ascent-signin-hero")) return true;
// Insert hero near the provider button’s form (most reliable anchor)
const form = providerBtn.closest("form") || providerBtn.parentElement;
if (!form) {
console.log("[CustomSigninScripts] form/parent not found for provider button");
return false;
}
const hero = document.createElement("div");
hero.className = "ascent-signin-hero";
// INLINE styles so it's visible even if CSS is missing/overridden
hero.style.minHeight = "55vh";
hero.style.display = "flex";
hero.style.flexDirection = "column";
hero.style.justifyContent = "center";
hero.style.alignItems = "center";
hero.style.gap = "18px";
hero.style.textAlign = "center";
hero.style.maxWidth = "900px";
hero.style.margin = "0 auto";
hero.style.padding = "0 20px";
const h1 = document.createElement("h1");
h1.textContent = "Welcome to Ascent, your Apollo Portal.";
h1.style.color = "#ffffff";
h1.style.fontWeight = "700";
h1.style.margin = "0";
const cta = document.createElement("button");
cta.type = "button";
cta.className = "btn btn-primary btn-line"; // reuse your CTA styling
cta.textContent = "Click here to sign in or register";
cta.addEventListener("click", function () {
providerBtn.click(); // triggers the real Entra external login
});
hero.appendChild(h1);
hero.appendChild(cta);
// Put hero BEFORE the provider button area so it appears even if the button is hidden
form.insertBefore(hero, form.firstChild);
console.log("[CustomSigninScripts] Sign-in hero injected ✅");
return true;
}
let tries = 0;
const timer = setInterval(() => {
tries++;
if (injectHero() || tries > 60) clearInterval(timer);
}, 200);
} catch (e) {
console.log("[CustomSigninScripts] error ❌", e);
}
})();