-
Notifications
You must be signed in to change notification settings - Fork 136
Fix featured toggle CSRF cookie lookup #1325
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: enext
Are you sure you want to change the base?
Conversation
Reviewer's guide (collapsed on small PRs)Reviewer's GuideEnhances CSRF token retrieval in the featured toggle AJAX call by introducing a dedicated lookup function that checks multiple cookie names and updates the request header to use this new selector. Class diagram for updated CSRF token retrieval logicclassDiagram
class main_js {
+handleFeaturedChange(element)
+initScrollPosition()
+getCsrfToken()
+getCookie(name)
}
main_js : getCsrfToken() checks ["eventyay_csrftoken", "pretalx_csrftoken", "csrftoken"]
main_js : getCookie(name) returns cookie value
main_js : handleFeaturedChange(element) uses getCsrfToken()
Flow diagram for CSRF token selection in AJAX requestflowchart TD
A["handleFeaturedChange() called"] --> B["getCsrfToken() called"]
B --> C{"Any CSRF cookie found?"}
C -- Yes --> D["Return cookie value"]
C -- No --> E["Return empty string"]
D & E --> F["Set X-CSRFToken header in AJAX request"]
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
mariobehling
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is the reason for closing and opening this? There is no issue about this. Usually PRs require an issue in most cases that outlines the problem. Please do so and update the PR description with "Fixes #issue number".
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR fixes CSRF token retrieval for the featured toggle functionality by introducing a more flexible cookie lookup mechanism that supports multiple cookie name conventions.
- Introduced a
getCsrfToken()helper function that searches for CSRF tokens across multiple cookie names (eventyay_csrftoken, pretalx_csrftoken, csrftoken) - Updated the featured toggle AJAX request to use the new helper instead of hardcoded cookie lookup
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Summary by Sourcery
Ensure CSRF token is correctly retrieved when toggling featured status in the organizer interface
Bug Fixes:
Enhancements: