Skip to content

Commit

Permalink
fix: ensure csrf cookie for searches (ietf-tools#8260)
Browse files Browse the repository at this point in the history
Needed on views that include search_form.html in their responses.
  • Loading branch information
jennifer-richards authored Nov 22, 2024
1 parent 394e32e commit 622ded5
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions ietf/doc/views_search.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@
from django.utils.html import strip_tags
from django.utils.cache import _generate_cache_key # type: ignore
from django.utils.text import slugify
from django.views.decorators.csrf import ensure_csrf_cookie
from django_stubs_ext import QuerySetAny

import debug # pyflakes:ignore
Expand Down Expand Up @@ -283,6 +284,7 @@ def retrieve_search_results(form, all_types=False):
return docs


@ensure_csrf_cookie
def search(request):
"""Search for a draft"""
# defaults for results / meta
Expand Down Expand Up @@ -335,6 +337,7 @@ def search(request):
)


@ensure_csrf_cookie
def frontpage(request):
form = SearchForm()
return render(request, 'doc/frontpage.html', {'form':form})
Expand Down

0 comments on commit 622ded5

Please sign in to comment.