From f0199fcbcc1347ffc86423e1af75dcc82c81eb9f Mon Sep 17 00:00:00 2001 From: Jeevan Sridharan Date: Wed, 19 Nov 2025 14:20:09 +0530 Subject: [PATCH] Fix featured toggle CSRF cookie lookup --- app/eventyay/static/orga/js/main.js | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/app/eventyay/static/orga/js/main.js b/app/eventyay/static/orga/js/main.js index 4f157a146e..34799ef4ab 100644 --- a/app/eventyay/static/orga/js/main.js +++ b/app/eventyay/static/orga/js/main.js @@ -23,7 +23,7 @@ const handleFeaturedChange = (element) => { method: "POST", headers: { "Content-Type": "application/json", - "X-CSRFToken": getCookie("pretalx_csrftoken"), + "X-CSRFToken": getCsrfToken(), }, credentials: "include", } @@ -52,6 +52,17 @@ const initScrollPosition = () => { } } +const getCsrfToken = () => { + const cookieNames = ["eventyay_csrftoken", "pretalx_csrftoken", "csrftoken"] + for (const name of cookieNames) { + const value = getCookie(name) + if (value) { + return value + } + } + return "" +} + const getCookie = (name) => { let cookieValue = null if (document.cookie && document.cookie !== "") {