Fix for the CRSF Token implementation
Release Inventarsystem / release-docker (push) Successful in 2m15s
Release Inventarsystem / release-docker (push) Successful in 2m15s
This commit is contained in:
@@ -328,7 +328,6 @@
|
|||||||
if (row.style.display !== 'none') {
|
if (row.style.display !== 'none') {
|
||||||
var cells = row.querySelectorAll('td');
|
var cells = row.querySelectorAll('td');
|
||||||
if (cells.length > 0) {
|
if (cells.length > 0) {
|
||||||
// Der Benutzername ist in der ersten Spalte (Index 0)
|
|
||||||
visibleUsernames.push(cells[0].textContent.trim());
|
visibleUsernames.push(cells[0].textContent.trim());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -339,19 +338,26 @@
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Dynamisches Formular erstellen, um die gefilterten Daten per POST ans Backend zu senden
|
// Dynamisches Formular erstellen
|
||||||
var form = document.createElement('form');
|
var form = document.createElement('form');
|
||||||
form.method = 'POST';
|
form.method = 'POST';
|
||||||
form.action = "{{ url_for('export_users_csv') }}"; // Passe dies ggf. an deinen Endpunktnamen an
|
form.action = "{{ url_for('export_users_csv') }}";
|
||||||
|
|
||||||
|
// 1. CSRF-Token hinzufügen
|
||||||
|
var csrfInput = document.createElement('input');
|
||||||
|
csrfInput.type = 'hidden';
|
||||||
|
csrfInput.name = 'csrf_token';
|
||||||
|
csrfInput.value = "{{ csrf_token() }}";
|
||||||
|
form.appendChild(csrfInput);
|
||||||
|
|
||||||
|
// 2. Gefilterte Benutzernamen hinzufügen
|
||||||
var input = document.createElement('input');
|
var input = document.createElement('input');
|
||||||
input.type = 'hidden';
|
input.type = 'hidden';
|
||||||
input.name = 'usernames';
|
input.name = 'usernames';
|
||||||
input.value = JSON.stringify(visibleUsernames);
|
input.value = JSON.stringify(visibleUsernames);
|
||||||
|
|
||||||
form.appendChild(input);
|
form.appendChild(input);
|
||||||
document.body.appendChild(form);
|
|
||||||
|
|
||||||
|
document.body.appendChild(form);
|
||||||
form.submit();
|
form.submit();
|
||||||
|
|
||||||
// Aufräumen
|
// Aufräumen
|
||||||
|
|||||||
Reference in New Issue
Block a user