"Improve database structure and templates for user login"

This commit is contained in:
2025-05-29 19:24:14 +02:00
parent 015daff378
commit efbb54c1e2
5 changed files with 219 additions and 11 deletions

View File

@@ -445,12 +445,12 @@
<!-- Drucker -->
<div>
<label for="{{ form.printer_id.id if form else 'printer_id' }}" class="block text-sm font-medium text-mercedes-black dark:text-slate-300 mb-2">
Gewünschter Drucker *
Gewünschter Drucker
</label>
{% if form %}
{{ form.printer_id(class="mercedes-form-input block w-full px-4 py-3", required="required") }}
{{ form.printer_id(class="mercedes-form-input block w-full px-4 py-3") }}
{% else %}
<select id="printer_id" name="printer_id" required class="mercedes-form-input block w-full px-4 py-3">
<select id="printer_id" name="printer_id" class="mercedes-form-input block w-full px-4 py-3">
<option value="">Drucker auswählen...</option>
<option value="1">Prusa i3 MK3S+ (PLA/PETG)</option>
<option value="2">Ultimaker S3 (PLA/ABS/PETG)</option>

View File

@@ -454,13 +454,13 @@
{% block scripts %}
<script>
let loginAttempts = parseInt(localStorage.getItem('loginAttempts') || '0');
let lastAttemptTime = parseInt(localStorage.getItem('lastAttemptTime') || '0');
let isFormLocked = false;
const MAX_ATTEMPTS = 5;
const LOCKOUT_DURATION = 15 * 60 * 1000; // 15 minutes
document.addEventListener('DOMContentLoaded', function() {
document.addEventListener('DOMContentLoaded', function() {
// TEMPORÄRES DEBUGGING: LocalStorage leeren
console.log("Clearing login attempts from localStorage...");
localStorage.removeItem('loginAttempts');
localStorage.removeItem('lastAttemptTime');
console.log("Login rate limiting reset");
initializeLoginForm();
checkRateLimit();
setupFormValidation();
@@ -469,6 +469,12 @@ document.addEventListener('DOMContentLoaded', function() {
setupAccessibility();
});
let loginAttempts = parseInt(localStorage.getItem('loginAttempts') || '0');
let lastAttemptTime = parseInt(localStorage.getItem('lastAttemptTime') || '0');
let isFormLocked = false;
const MAX_ATTEMPTS = 5;
const LOCKOUT_DURATION = 15 * 60 * 1000; // 15 minutes
function initializeLoginForm() {
const form = document.getElementById('loginForm');
const submitBtn = document.getElementById('submitBtn');
@@ -511,6 +517,10 @@ document.addEventListener('DOMContentLoaded', function() {
const now = Date.now();
const timeSinceLastAttempt = now - lastAttemptTime;
// TEMPORÄR DEAKTIVIERT FÜR DEBUGGING
console.log("Rate Limiting temporär deaktiviert");
return; // Frühes Return verhindert Rate Limiting
if (loginAttempts >= MAX_ATTEMPTS && timeSinceLastAttempt < LOCKOUT_DURATION) {
const remainingTime = LOCKOUT_DURATION - timeSinceLastAttempt;
showRateLimitWarning(remainingTime);