Upload via GUI (452 Dateien)
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
<?php
|
||||
require_once __DIR__ . '/../includes/bootstrap.php';
|
||||
require_once __DIR__ . '/../includes/totp.php';
|
||||
require_once __DIR__ . '/../includes/webauthn.php';
|
||||
|
||||
if (current_staff()) {
|
||||
redirect('/staff/reports.php');
|
||||
@@ -45,8 +46,10 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST' && !csrf_valid()) {
|
||||
$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), login_guard_max_attempts(), login_guard_lock_minutes())) {
|
||||
// Konto-basierte Sperre – verhindert Brute-Force über wechselnde IPs
|
||||
} elseif ($email && !rate_limit_check('staff_login_email', strtolower($email), login_guard_max_attempts(), login_guard_lock_minutes()) && !login_guard_known_device_for_email($email)) {
|
||||
// Konto-basierte Sperre – verhindert Brute-Force über wechselnde IPs. Ein bekanntes Gerät des Kontos (Cookie von einer früheren Anmeldung)
|
||||
// wird davon nicht ausgesperrt: Sonst könnte jeder, der die Adresse kennt, den echten Mitarbeiter mit Fehlversuchen dauerhaft aussperren.
|
||||
// Die Sperre je IP-Adresse gilt auch für bekannte Geräte.
|
||||
login_guard_locked($email, 'web');
|
||||
$errors[] = 'Zu viele Anmeldeversuche für dieses Konto. Bitte warten Sie einige Minuten.';
|
||||
} else {
|
||||
@@ -152,9 +155,14 @@ $displayName = get_setting('display_name', config()['site']['name']);
|
||||
</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
|
||||
$loginButtons = (string) plugin_filter('staff.login.buttons', '', []);
|
||||
$passkeyOn = webauthn_enabled();
|
||||
// Gleiche Gestaltung wie die Knöpfe der Anmelde-Plugins (zum Beispiel authentik): ein Block, gleiche Größe, Symbol vor der Beschriftung
|
||||
$passkeyBtn = $passkeyOn ? '<button type="button" id="passkey-login" class="btn secondary" style="display:none;text-align:center;width:100%"><svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" style="vertical-align:-5px;margin-right:8px"><circle cx="8" cy="15" r="4"/><path d="M10.85 12.15 19 4"/><path d="m18 5 3 3"/><path d="m15 8 2 2"/></svg>Mit Passkey anmelden</button><div id="passkey-msg" class="flash error" style="display:none;margin:0"></div>' : '';
|
||||
?>
|
||||
<?php if ($passkeyBtn . $loginButtons !== ''): ?>
|
||||
<div class="login-alt" id="login-alt" style="margin-top:18px;padding-top:16px;border-top:1px solid #e2e8f0;display:grid;gap:10px"><?= $passkeyBtn . $loginButtons ?></div>
|
||||
<?php endif; ?>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
@@ -165,7 +173,24 @@ $displayName = get_setting('display_name', config()['site']['name']);
|
||||
<span>Copyright © <?= date('Y') ?> <?= e($displayName) ?> – Alle Rechte vorbehalten.</span>
|
||||
</footer>
|
||||
|
||||
<script src="/assets/js/passkey.js?v=<?= @filemtime(__DIR__ . '/../assets/js/passkey.js') ?: time() ?>"></script>
|
||||
<script>
|
||||
(function () {
|
||||
var btn = document.getElementById('passkey-login'), msg = document.getElementById('passkey-msg'), alt = document.getElementById('login-alt');
|
||||
if (!btn) return;
|
||||
if (!window.DeskHubPasskey || !DeskHubPasskey.supported()) {
|
||||
// Browser ohne Passkeys: Knopf bleibt weg, der Block auch, wenn sonst nichts darin steht
|
||||
if (alt && alt.querySelectorAll('a, button').length <= 1) alt.style.display = 'none';
|
||||
return;
|
||||
}
|
||||
btn.style.display = 'block';
|
||||
btn.addEventListener('click', function () {
|
||||
msg.style.display = 'none';
|
||||
btn.disabled = true;
|
||||
DeskHubPasskey.login(<?= json_encode(csrf_token()) ?>).then(function (r) { location.href = r.redirect || '/staff/reports.php'; })
|
||||
.catch(function (e) { msg.textContent = e.message; msg.style.display = 'block'; btn.disabled = false; });
|
||||
});
|
||||
})();
|
||||
// Hält die Sitzung der offenen Anmeldeseite am Leben: Der Server räumt ungenutzte Sitzungen nach etwa 24 Minuten auf, und dann wäre das
|
||||
// Anmeldeformular ungültig. Ein kurzer Abruf alle 8 Minuten genügt.
|
||||
setInterval(function () { fetch('/staff/session_ping.php?check=1', { credentials: 'same-origin', cache: 'no-store' }).catch(function () {}); }, 8 * 60 * 1000);
|
||||
|
||||
Reference in New Issue
Block a user