feat: Implementiere Login- und Authentifizierungssystem

Co-authored-by: aider (gemini/gemini-2.5-pro) <aider@aider.chat>
This commit is contained in:
torsten 2026-10-04 08:11:52 +02:00
parent eed4c00645
commit 9baaeafd1c
5 changed files with 193 additions and 4 deletions

26
src/Views/login.php Normal file
View file

@ -0,0 +1,26 @@
<?php
$pageTitle = 'Login';
require __DIR__ . '/partials/header.php';
?>
<h1>Login</h1>
<?php if (isset($error)): ?>
<p style="color: red;"><?php echo htmlspecialchars($error); ?></p>
<?php endif; ?>
<form action="/index.php?page=login" method="post">
<div>
<label for="email">E-Mail:</label>
<input type="email" id="email" name="email" required>
</div>
<div>
<label for="password">Passwort:</label>
<input type="password" id="password" name="password" required>
</div>
<div>
<button type="submit">Anmelden</button>
</div>
</form>
<?php require __DIR__ . '/partials/footer.php'; ?>

View file

@ -14,4 +14,12 @@
<a href="#">Tipps</a>
<a href="/index.php?page=ranking">Rangliste</a>
<a href="#">Info</a>
<div style="margin-left: auto;">
<?php if (App\Core\Auth::check()): ?>
<span style="margin-right: 1em;">Hallo, <?php echo htmlspecialchars(App\Core\Auth::user()['name']); ?>!</span>
<a href="/index.php?page=logout">Logout</a>
<?php else: ?>
<a href="/index.php?page=login">Login</a>
<?php endif; ?>
</div>
</nav>