fix(auth): immediate auto-redirect from landing page to dashboard for authenticated users and cache-busting v2.1.0
This commit is contained in:
parent
6bfcca578b
commit
b6aede1fc4
9 changed files with 40 additions and 24 deletions
|
|
@ -438,7 +438,7 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<script src="assets/app_auth.js"></script>
|
<script src="assets/app_auth.js?v=2.1.0"></script>
|
||||||
<script>
|
<script>
|
||||||
let ALL_USERS = [];
|
let ALL_USERS = [];
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -497,6 +497,10 @@
|
||||||
|
|
||||||
// Auth Modal UI
|
// Auth Modal UI
|
||||||
window.openAuthModal = function (initialMode = 'login', options = {}) {
|
window.openAuthModal = function (initialMode = 'login', options = {}) {
|
||||||
|
if (window.AUTH && window.AUTH.isLoggedIn()) {
|
||||||
|
window.location.href = 'dashboard.html';
|
||||||
|
return;
|
||||||
|
}
|
||||||
const allowClose = options.allowClose !== false;
|
const allowClose = options.allowClose !== false;
|
||||||
let modal = document.getElementById('auth-modal-overlay');
|
let modal = document.getElementById('auth-modal-overlay');
|
||||||
if (modal) modal.remove();
|
if (modal) modal.remove();
|
||||||
|
|
@ -679,13 +683,8 @@
|
||||||
if (options.onSuccess) {
|
if (options.onSuccess) {
|
||||||
options.onSuccess(result.user);
|
options.onSuccess(result.user);
|
||||||
} else {
|
} else {
|
||||||
window.AUTH.updateUI();
|
try { window.AUTH.updateUI(); } catch (e) {}
|
||||||
const p = window.location.pathname;
|
|
||||||
if (p.endsWith('index.html') || p === '/' || p.endsWith('/')) {
|
|
||||||
window.location.href = 'dashboard.html';
|
window.location.href = 'dashboard.html';
|
||||||
} else {
|
|
||||||
window.location.reload();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
errorBox.innerText = result.error || 'Fehler bei der Authentifizierung';
|
errorBox.innerText = result.error || 'Fehler bei der Authentifizierung';
|
||||||
|
|
@ -703,7 +702,11 @@
|
||||||
const params = new URLSearchParams(window.location.search);
|
const params = new URLSearchParams(window.location.search);
|
||||||
const authParam = params.get('auth');
|
const authParam = params.get('auth');
|
||||||
if (authParam === 'login' || authParam === 'register') {
|
if (authParam === 'login' || authParam === 'register') {
|
||||||
|
if (!window.AUTH.isLoggedIn()) {
|
||||||
window.openAuthModal(authParam, { allowClose: true });
|
window.openAuthModal(authParam, { allowClose: true });
|
||||||
|
} else {
|
||||||
|
window.location.replace('dashboard.html');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
})();
|
})();
|
||||||
|
|
|
||||||
|
|
@ -104,7 +104,7 @@
|
||||||
|
|
||||||
if (!window.AUTH) {
|
if (!window.AUTH) {
|
||||||
const authScript = document.createElement('script');
|
const authScript = document.createElement('script');
|
||||||
authScript.src = `${rootPrefix}assets/app_auth.js`;
|
authScript.src = `${rootPrefix}assets/app_auth.js?v=2.1.0`;
|
||||||
authScript.onload = () => proceed();
|
authScript.onload = () => proceed();
|
||||||
authScript.onerror = () => proceed();
|
authScript.onerror = () => proceed();
|
||||||
document.head.appendChild(authScript);
|
document.head.appendChild(authScript);
|
||||||
|
|
|
||||||
|
|
@ -301,7 +301,7 @@
|
||||||
<a href="workspace.html?course=python" class="portal-btn-primary" style="padding: 10px 18px; font-size: 0.9rem;">
|
<a href="workspace.html?course=python" class="portal-btn-primary" style="padding: 10px 18px; font-size: 0.9rem;">
|
||||||
<span>💻 Web-IDE öffnen</span>
|
<span>💻 Web-IDE öffnen</span>
|
||||||
</a>
|
</a>
|
||||||
<a href="index.html" class="portal-btn-secondary" style="padding: 10px 16px; font-size: 0.9rem;" title="Zur öffentlichen Plattform-Startseite">
|
<a href="index.html?view=landing" class="portal-btn-secondary" style="padding: 10px 16px; font-size: 0.9rem;" title="Zur öffentlichen Plattform-Startseite">
|
||||||
<span>🌐 Startseite</span>
|
<span>🌐 Startseite</span>
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -1152,7 +1152,7 @@
|
||||||
<li><a href="#ihk-section" class="portal-footer-link">🎓 IHK Prüfungstrainer</a></li>
|
<li><a href="#ihk-section" class="portal-footer-link">🎓 IHK Prüfungstrainer</a></li>
|
||||||
<li><a href="workspace.html?course=python" class="portal-footer-link">💻 Web-IDE starten</a></li>
|
<li><a href="workspace.html?course=python" class="portal-footer-link">💻 Web-IDE starten</a></li>
|
||||||
<li><a href="#zertifikate-section" class="portal-footer-link">🏆 Meine Zertifikate</a></li>
|
<li><a href="#zertifikate-section" class="portal-footer-link">🏆 Meine Zertifikate</a></li>
|
||||||
<li><a href="index.html" class="portal-footer-link">🌐 Zur Plattform-Startseite</a></li>
|
<li><a href="index.html?view=landing" class="portal-footer-link">🌐 Zur Plattform-Startseite</a></li>
|
||||||
<li class="teacher-only" style="display: none;"><a href="teacher.html" class="portal-footer-link" id="footer-teacher-link">👨🏫 Dozenten-Portal</a></li>
|
<li class="teacher-only" style="display: none;"><a href="teacher.html" class="portal-footer-link" id="footer-teacher-link">👨🏫 Dozenten-Portal</a></li>
|
||||||
<li class="admin-only" style="display: none;"><a href="admin.html" class="portal-footer-link" id="footer-admin-link">🛡️ Administration</a></li>
|
<li class="admin-only" style="display: none;"><a href="admin.html" class="portal-footer-link" id="footer-admin-link">🛡️ Administration</a></li>
|
||||||
</ul>
|
</ul>
|
||||||
|
|
@ -1185,10 +1185,10 @@
|
||||||
</footer>
|
</footer>
|
||||||
|
|
||||||
<!-- Scripts -->
|
<!-- Scripts -->
|
||||||
<script src="assets/app_auth.js"></script>
|
<script src="assets/app_auth.js?v=2.1.0"></script>
|
||||||
<script src="assets/it_ausbildungen_manifest.js"></script>
|
<script src="assets/it_ausbildungen_manifest.js?v=2.1.0"></script>
|
||||||
<script src="assets/courses_manifest.js"></script>
|
<script src="assets/courses_manifest.js?v=2.1.0"></script>
|
||||||
<script src="assets/certificate.js"></script>
|
<script src="assets/certificate.js?v=2.1.0"></script>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
function toggleMobileMenu() {
|
function toggleMobileMenu() {
|
||||||
|
|
|
||||||
|
|
@ -276,7 +276,7 @@
|
||||||
</footer>
|
</footer>
|
||||||
|
|
||||||
<!-- Scripts -->
|
<!-- Scripts -->
|
||||||
<script src="assets/app_auth.js"></script>
|
<script src="assets/app_auth.js?v=2.1.0"></script>
|
||||||
<script>
|
<script>
|
||||||
function toggleMobileMenu() {
|
function toggleMobileMenu() {
|
||||||
const drawer = document.getElementById('portal-mobile-drawer');
|
const drawer = document.getElementById('portal-mobile-drawer');
|
||||||
|
|
|
||||||
|
|
@ -230,7 +230,7 @@
|
||||||
</footer>
|
</footer>
|
||||||
|
|
||||||
<!-- Scripts -->
|
<!-- Scripts -->
|
||||||
<script src="assets/app_auth.js"></script>
|
<script src="assets/app_auth.js?v=2.1.0"></script>
|
||||||
<script>
|
<script>
|
||||||
function toggleMobileMenu() {
|
function toggleMobileMenu() {
|
||||||
const drawer = document.getElementById('portal-mobile-drawer');
|
const drawer = document.getElementById('portal-mobile-drawer');
|
||||||
|
|
|
||||||
15
index.html
15
index.html
|
|
@ -11,6 +11,20 @@
|
||||||
<meta property="og:type" content="website">
|
<meta property="og:type" content="website">
|
||||||
<meta property="og:url" content="https://alpha.it-praxisportal.de/">
|
<meta property="og:url" content="https://alpha.it-praxisportal.de/">
|
||||||
<link rel="stylesheet" href="assets/style.css">
|
<link rel="stylesheet" href="assets/style.css">
|
||||||
|
<script src="assets/app_auth.js?v=2.1.0"></script>
|
||||||
|
<script>
|
||||||
|
// Sofortige automatische Weiterleitung für angemeldete Nutzer direkt ins Dashboard
|
||||||
|
(function autoRedirectLoggedInUser() {
|
||||||
|
try {
|
||||||
|
if (window.AUTH && window.AUTH.isLoggedIn()) {
|
||||||
|
var p = new URLSearchParams(window.location.search);
|
||||||
|
if (!p.has('view') && !p.has('landing') && !p.has('preview')) {
|
||||||
|
window.location.replace('dashboard.html');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (e) {}
|
||||||
|
})();
|
||||||
|
</script>
|
||||||
<style>
|
<style>
|
||||||
.portal-container {
|
.portal-container {
|
||||||
max-width: 1240px;
|
max-width: 1240px;
|
||||||
|
|
@ -821,7 +835,6 @@
|
||||||
</footer>
|
</footer>
|
||||||
|
|
||||||
<!-- Scripts -->
|
<!-- Scripts -->
|
||||||
<script src="assets/app_auth.js"></script>
|
|
||||||
<script>
|
<script>
|
||||||
function toggleMobileMenu() {
|
function toggleMobileMenu() {
|
||||||
const drawer = document.getElementById('portal-mobile-drawer');
|
const drawer = document.getElementById('portal-mobile-drawer');
|
||||||
|
|
|
||||||
|
|
@ -279,9 +279,9 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<script src="assets/app_auth.js"></script>
|
<script src="assets/app_auth.js?v=2.1.0"></script>
|
||||||
<script src="assets/courses_manifest.js"></script>
|
<script src="assets/courses_manifest.js?v=2.1.0"></script>
|
||||||
<script src="assets/it_ausbildungen_manifest.js"></script>
|
<script src="assets/it_ausbildungen_manifest.js?v=2.1.0"></script>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
// 🔒 1. STRIKTER ROLLEN-GUARD FÜR DOZENTEN / ADMINS
|
// 🔒 1. STRIKTER ROLLEN-GUARD FÜR DOZENTEN / ADMINS
|
||||||
|
|
|
||||||
|
|
@ -353,8 +353,8 @@
|
||||||
<script src="assets/gamification_data.js"></script>
|
<script src="assets/gamification_data.js"></script>
|
||||||
<script src="assets/gamification.js"></script>
|
<script src="assets/gamification.js"></script>
|
||||||
<script src="assets/interpreter.js"></script>
|
<script src="assets/interpreter.js"></script>
|
||||||
<script src="assets/certificate.js"></script>
|
<script src="assets/certificate.js?v=2.1.0"></script>
|
||||||
<script src="assets/app_auth.js"></script>
|
<script src="assets/app_auth.js?v=2.1.0"></script>
|
||||||
<script src="assets/parsons.js"></script>
|
<script src="assets/parsons.js"></script>
|
||||||
<script src="assets/code_guard.js"></script>
|
<script src="assets/code_guard.js"></script>
|
||||||
<script src="assets/runners/runner_registry.js"></script>
|
<script src="assets/runners/runner_registry.js"></script>
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue