<?php require_once __DIR__.'/../app/bootstrap.php'; csrf_check(); $error=''; if($_SERVER['REQUEST_METHOD']==='POST'){ $email=trim($_POST['email']??''); [$allowed,$rateMessage]=rate_limit_check($pdo,$config,'login',5,15*60,15*60,$email); if(!$allowed){ $error=$rateMessage; } elseif(login($pdo, $email, $_POST['password']??'')){ rate_limit_clear($pdo,$config,'login',$email); $loggedInUser = current_user($pdo); if ($loggedInUser && is_superadmin($loggedInUser) && function_exists('qrator_update_refresh_status')) { qrator_update_refresh_status(true, 1800); } header('Location: dashboard.php'); exit; } else { $error = $_SESSION['login_message'] ?? 'Login fehlgeschlagen oder Konto vorübergehend gesperrt.'; } } ?>
<!doctype html><html lang="de"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1"><title>Login · KuhRator</title><link rel="stylesheet" href="../public/assets/style.css"><script nonce="<?= e(qrmanager_csp_nonce()) ?>" src="../public/assets/admin.js" defer></script></head><body><main class="login auth-screen"><form method="post" class="card formgrid auth-card"><div class="auth-logo"><img src="../public/assets/qrator-logo.png" alt="KuhRator Logo"></div><h1>KuhRator Login</h1><?php if($error): ?><p class="notice"><?= e($error) ?></p><?php endif; ?><input type="hidden" name="csrf" value="<?= e(csrf_token()) ?>"><label>E-Mail<input name="email" type="email" required autofocus value="<?= e($_POST['email'] ?? '') ?>"></label><label>Passwort<span class="password-field"><input name="password" type="password" required data-password-toggle><button type="button" class="password-toggle" data-password-toggle-button aria-label="Passwort anzeigen" aria-pressed="false"><span class="eye-open" aria-hidden="true">&#128065;</span><span class="eye-closed" aria-hidden="true">&#128584;</span></button></span></label><button class="btn">Einloggen</button><p><a href="forgot-password.php">Passwort vergessen?</a><?php if(!empty($config['registration_enabled'])): ?> · <a href="register.php">Registrieren</a><?php endif; ?></p></form></main></body></html>
