🐛 Refactor: Consolidated user management and security functions in the backend. Added legal pages blueprint for compliance. Removed legacy rate limiter functions to streamline security integration. Updated logging for better clarity. 📚

This commit is contained in:
2025-06-12 20:44:11 +02:00
parent 69fd3187cf
commit 6b8fca218b
19 changed files with 698 additions and 3639 deletions

View File

@ -1903,9 +1903,29 @@ class JobManager {
// File upload handling (optional)
const fileInput = document.getElementById('stl_file');
let uploadedFilePath = null;
if (fileInput.files.length > 0) {
// TODO: Implement file upload
console.log('File selected:', fileInput.files[0]);
try {
// Datei hochladen
const uploadResult = await this.uploadJobFile(fileInput.files[0]);
if (uploadResult.success) {
uploadedFilePath = uploadResult.path;
console.log('Datei erfolgreich hochgeladen:', uploadResult.filename);
} else {
this.showError(`Fehler beim Datei-Upload: ${uploadResult.error}`);
return;
}
} catch (error) {
console.error('Fehler beim Datei-Upload:', error);
this.showError('Fehler beim Hochladen der Datei');
return;
}
}
// Uploaded file path zu Job-Daten hinzufügen
if (uploadedFilePath) {
jobData.file_path = uploadedFilePath;
}
try {
@ -1938,6 +1958,41 @@ class JobManager {
}
}
// ===== FILE UPLOAD =====
async uploadJobFile(file) {
/**
* Lädt eine Job-Datei hoch und gibt das Ergebnis zurück
* @param {File} file - Die hochzuladende Datei
* @returns {Promise<Object>} Upload-Ergebnis mit success, path, filename, etc.
*/
try {
// FormData für Upload erstellen
const formData = new FormData();
formData.append('file', file);
// Upload-Request senden
const response = await fetch('/api/upload/job', {
method: 'POST',
headers: {
'X-CSRFToken': this.getCSRFToken()
},
body: formData
});
const result = await response.json();
if (!response.ok) {
throw new Error(result.error || 'Upload fehlgeschlagen');
}
return result;
} catch (error) {
console.error('Fehler beim Datei-Upload:', error);
throw error;
}
}
// ===== UTILITY FUNCTIONS =====
getCSRFToken() {
@ -2097,7 +2152,6 @@ function changePage(direction) {
}
function showQuickReservation() {
console.log('🔧 TEST: showQuickReservation() aufgerufen');
showModal('quickReservationModal');
}