Resolve merge conflicts and fix styling issues

- Resolve all merge conflicts from main branch pull
- Fix CSS load order: global stylesheet before page-specific on all pages
- Add navigation.js to impressum.html and datenschutz.html
- Unify nav classes across all pages (nav-tab-links + button-small)
- Add footer styles to global stylesheet
- Remove duplicate landingpage.css (redundant with index.css)
- Fix duplicate head/body tags in event_detail.html
- Merge login.js: keep user auth logic + snackbar support
- Merge index-carousel.js: keep dots + responsive resize handling
This commit is contained in:
Estelle Köhler committed 2026-04-12 10:49:17 +02:00
commit 5ee62ff604
27 files changed
+2823 -356

No files matched your search

+67 -4
View File
@@ -1,9 +1,52 @@
// =============================================
// Login-Logik
// Diese Datei validiert die Eingaben, sucht den
// Benutzer im localStorage und legt die Session an.
// =============================================
// Formular und Felder aus dem HTML holen.
const loginForm = document.getElementById('loginForm');
const emailInput = document.getElementById('email');
const passwortInput = document.getElementById('passwort');
const emailError = document.getElementById('emailError');
const passwortError = document.getElementById('passwortError');
const USERS_STORAGE_KEY = 'socialCookingUsers';
const CURRENT_USER_KEY = 'socialCookingCurrentUser';
// Liest alle registrierten Benutzer robust aus localStorage.
function getStoredUsers() {
try {
const raw = localStorage.getItem(USERS_STORAGE_KEY);
return raw ? JSON.parse(raw) : [];
} catch (error) {
console.error('Benutzerdaten konnten nicht gelesen werden.', error);
return [];
}
}
// Speichert den aktiven Benutzer fuer nachfolgende Seiten.
function setCurrentUser(user) {
localStorage.setItem(CURRENT_USER_KEY, JSON.stringify(user));
}
// Erstellt einen Demo-Benutzer, falls fuer die E-Mail noch kein Account existiert.
function createFallbackUser(email, passwort) {
const localPart = email.split('@')[0] || 'Gast';
const normalized = localPart.replace(/[._-]/g, ' ').trim();
const guessedVorname = normalized ? normalized.split(' ')[0] : 'Gast';
return {
id: Date.now(),
vorname: guessedVorname.charAt(0).toUpperCase() + guessedVorname.slice(1),
nachname: '',
email,
passwort,
createdAt: new Date().toISOString(),
source: 'login-fallback'
};
}
// Validierungsfunktion
function validateForm(event) {
event.preventDefault();
@@ -43,13 +86,33 @@ function validateForm(event) {
passwortGroup.classList.remove('has-error');
}
// Wenn alle Validierungen bestanden, Form absenden
// Wenn alle Validierungen bestanden, pruefen wir:
// 1) gibt es den Benutzer schon?
// 2) ist das Passwort korrekt?
// Danach speichern wir die aktive Session.
if (isValid) {
const users = getStoredUsers();
const matchedUser = users.find(user => user.email?.toLowerCase() === emailValue.toLowerCase());
if (matchedUser && matchedUser.passwort !== passwortValue) {
passwortGroup.classList.add('has-error');
passwortError.textContent = 'Das Passwort ist nicht korrekt.';
return;
}
const userToLogin = matchedUser || createFallbackUser(emailValue, passwortValue);
setCurrentUser(userToLogin);
// Snackbar anzeigen und dann zur Event-Uebersicht weiterleiten.
var snackbar = document.getElementById('snackbar');
snackbar.classList.add('snackbar--visible');
setTimeout(function() {
if (snackbar) {
snackbar.classList.add('snackbar--visible');
setTimeout(function() {
window.location.href = 'event_overview.html';
}, 2000);
} else {
window.location.href = 'event_overview.html';
}, 2000);
}
}
}