Initial commit: OMSORG website + Mitarbeiter-App

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Felix Kemmler
2026-06-13 20:03:22 +02:00
co-authored by Claude Sonnet 4.6
commit 8beb0fcf52
103 changed files with 7384 additions and 0 deletions
+94
View File
@@ -0,0 +1,94 @@
<?php
require_once __DIR__ . '/lib/auth.php';
if (is_logged_in()) {
header('Location: pages/dashboard.php');
exit;
}
$error = '';
$locked = false;
$MAX_FAILS = 5;
$LOCKOUT_SEC = 600;
$ip = $_SERVER['REMOTE_ADDR'] ?? '';
$fails = login_recent_fails($ip, $LOCKOUT_SEC);
if ($fails >= $MAX_FAILS) {
$locked = true;
$error = 'Zu viele Fehlversuche. Bitte warte ca. 10 Minuten.';
}
if (!$locked && $_SERVER['REQUEST_METHOD'] === 'POST') {
verify_csrf();
$username = trim($_POST['username'] ?? '');
$password = $_POST['password'] ?? '';
if ($username !== '' && $password !== '') {
$stmt = db()->prepare(
'SELECT * FROM users WHERE LOWER(username) = LOWER(?) AND active = 1'
);
$stmt->execute([$username]);
$user = $stmt->fetch();
if ($user && password_verify($password, $user['password_hash'])) {
login_clear_fails($ip);
session_regenerate_id(true);
$_SESSION['felix_logged_in'] = true;
$_SESSION['felix_username'] = $user['username'];
$_SESSION['felix_name'] = $user['name'];
$_SESSION['felix_role'] = $user['role'];
header('Location: pages/dashboard.php');
exit;
}
}
login_record_fail($ip, $username ?? '');
$error = 'Benutzername oder Passwort falsch.';
}
?>
<!DOCTYPE html>
<html lang="de">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width,initial-scale=1">
<title>OMSORG Felix Login</title>
<link rel="stylesheet" href="app.css">
<link rel="manifest" href="manifest.webmanifest">
<meta name="theme-color" content="#1a3a5c">
</head>
<body>
<div class="login-page">
<div class="login-card glass">
<div class="brand" style="text-align:center">
<img src="assets/omsorg-wordmark-new.png" alt="OMSORG" style="width:210px;margin:0 auto 22px">
</div>
<h2 style="font-family:'KindelSerif',Georgia,serif;font-size:1.7rem;margin:0 0 6px">Mitarbeiter-App</h2>
<p class="hint" style="margin:0 0 22px">Melde dich mit deinem Benutzerkonto an.</p>
<?php if ($error): ?>
<div class="error" style="margin-bottom:16px"><?= e($error) ?></div>
<?php endif; ?>
<form method="post">
<?= csrf_field() ?>
<label>
Benutzername
<input type="text" name="username" autocomplete="username" required autofocus
value="<?= e($_POST['username'] ?? '') ?>">
</label>
<label>
Passwort
<input type="password" name="password" autocomplete="current-password" required>
</label>
<button type="submit" class="btn" style="width:100%;margin-top:6px">Anmelden</button>
</form>
</div>
</div>
<script>
if ('serviceWorker' in navigator) navigator.serviceWorker.register('service-worker.js');
</script>
</body>
</html>