fc572fc3f3
- renderLogin/renderRegister: bei vorhandenem Token sofort → /konto/ (behebt 'man bleibt nicht eingeloggt' — Formular wurde trotz Token gezeigt) - nav-account.js (auf allen Seiten via custom/head-end.html): CTAs auf /register/ und Navbar 'Anmelden' (/login/) → 'Mein Konto' (/konto/) sobald eingeloggt. So führt /hosting/ den Kunden direkt ins Konto. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
33 lines
1.3 KiB
JavaScript
33 lines
1.3 KiB
JavaScript
/* RAPPORT Hosting — Navbar/CTA-Anpassung je nach Login-Status.
|
|
* Läuft auf ALLEN Seiten (im baseof eingebunden). Wenn ein Kunde eingeloggt
|
|
* ist (rapport_host_token vorhanden), werden:
|
|
* - Hosting-CTAs ("Jetzt starten" / "Kostenlos registrieren") → "Mein Konto"
|
|
* - der Navbar-Eintrag "Anmelden" → "Mein Konto"
|
|
* So landet ein eingeloggter Kunde nicht wieder im Marketing-/Login-Flow.
|
|
*/
|
|
(function () {
|
|
"use strict";
|
|
var loggedIn = !!localStorage.getItem("rapport_host_token");
|
|
if (!loggedIn) return;
|
|
|
|
function ready(fn) {
|
|
if (document.readyState !== "loading") fn();
|
|
else document.addEventListener("DOMContentLoaded", fn);
|
|
}
|
|
|
|
ready(function () {
|
|
// 1. Hero-/CTA-Buttons, die auf /register/ zeigen → /konto/ "Mein Konto"
|
|
document.querySelectorAll('a[href="/register/"]').forEach(function (a) {
|
|
a.setAttribute("href", "/konto/");
|
|
a.textContent = "Mein Konto";
|
|
});
|
|
// 2. Navbar-Link "Anmelden" (zeigt auf /login/) → "Mein Konto"
|
|
document.querySelectorAll('a[href="/login/"]').forEach(function (a) {
|
|
a.setAttribute("href", "/konto/");
|
|
// Navbar-Label kann in einem <span> liegen
|
|
var span = a.querySelector("span");
|
|
if (span) span.textContent = "Mein Konto"; else a.textContent = "Mein Konto";
|
|
});
|
|
});
|
|
})();
|