Upload via GUI (360 Dateien)

This commit is contained in:
2026-10-30 21:50:04 +00:00
parent 91ae4659b5
commit fa7cb047a9
6 changed files with 879 additions and 322 deletions
+20 -4
View File
@@ -24,21 +24,30 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST' && !csrf_valid()) {
$stmt = get_db()->prepare('SELECT * FROM staff WHERE id = ? AND is_active = 1');
$stmt->execute([$pendingId]);
$staff = $stmt->fetch();
if ($staff && totp_verify($staff['totp_secret'], $code)) {
if ($staff && !rate_limit_check('staff_totp_attempt', (string) $pendingId, login_guard_max_attempts(), login_guard_lock_minutes())) {
// Code-Raten bremsen: nach zu vielen Fehlversuchen muss das Passwort neu eingegeben werden
unset($_SESSION['totp_pending_staff_id']);
login_guard_locked((string) $staff['email'], 'web');
$errors[] = 'Zu viele falsche Codes. Bitte warten Sie einige Minuten und melden Sie sich neu an.';
} elseif ($staff && totp_verify($staff['totp_secret'], $code)) {
unset($_SESSION['totp_pending_staff_id']);
rate_limit_reset('staff_totp_attempt', (string) $pendingId);
staff_login($staff);
redirect('/staff/reports.php');
} else {
if ($staff) login_guard_failed($staff, (string) $staff['email'], 'web', 'Falscher 2FA-Code');
$errors[] = 'Ungültiger Code. Bitte erneut versuchen.';
$need2fa = true;
}
$errors[] = 'Ungültiger Code. Bitte erneut versuchen.';
$need2fa = true;
}
} else {
$email = trim($_POST['email'] ?? '');
$pass = $_POST['password'] ?? '';
if (!rate_limit_check('staff_login_attempt', client_ip(), 10, 15)) {
$errors[] = 'Zu viele Anmeldeversuche. Bitte versuchen Sie es in einigen Minuten erneut.';
} elseif ($email && !rate_limit_check('staff_login_email', strtolower($email), 5, 15)) {
} elseif ($email && !rate_limit_check('staff_login_email', strtolower($email), login_guard_max_attempts(), login_guard_lock_minutes())) {
// Konto-basierte Sperre – verhindert Brute-Force über wechselnde IPs
login_guard_locked($email, 'web');
$errors[] = 'Zu viele Anmeldeversuche für dieses Konto. Bitte warten Sie einige Minuten.';
} else {
$stmt = get_db()->prepare('SELECT * FROM staff WHERE LOWER(email) = LOWER(?) AND is_active = 1');
@@ -55,6 +64,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST' && !csrf_valid()) {
redirect('/staff/reports.php');
}
} else {
login_guard_failed($staff ?: null, $email, 'web', $staff ? 'Falsches Passwort' : 'Unbekannte E-Mail-Adresse');
$errors[] = 'E-Mail-Adresse oder Passwort ist falsch.';
}
}
@@ -141,6 +151,12 @@ $displayName = get_setting('display_name', config()['site']['name']);
</div>
</form>
<?php endif; ?>
<?php if (!$need2fa): ?>
<?php $loginButtons = (string) plugin_filter('staff.login.buttons', '', []); ?>
<?php if ($loginButtons !== ''): ?>
<div class="login-alt" style="margin-top:18px;padding-top:16px;border-top:1px solid #e2e8f0;display:grid;gap:10px"><?= $loginButtons ?></div>
<?php endif; ?>
<?php endif; ?>
</div>
</div>