Merge pull request #2453 from Stirling-Tools/csrf2

Csrf fixes
This commit is contained in:
Anthony Stirling
2024-12-14 10:59:50 +00:00
committed by GitHub
8 changed files with 8 additions and 9 deletions

View File

@@ -242,7 +242,7 @@
let errorMessage = null;
try {
const response = await fetch(url, {method: 'POST', body: formData});
const response = await window.fetchWithCsrf(url, {method: 'POST', body: formData});
const contentType = response.headers.get('content-type');
if (!response.ok) {

View File

@@ -8,7 +8,6 @@ window.fetchWithCsrf = async function(url, options = {}) {
if (cookieValue) {
return cookieValue;
}
const csrfElement = document.querySelector('input[name="_csrf"]');
return csrfElement ? csrfElement.value : null;
}