Commit 592fc6d7 authored by okhin's avatar okhin 🚴

Merge branch '195-csrf-verification-failed-csrf-cookie-when-submitting-forms' into 'master'

Let's enforce csrf on home, it seems the cookie is never sent to the client only…

Closes #195

See merge request !204
parents c8d4df46 8cc240ed
......@@ -5,6 +5,8 @@ import random
from django.db.models import Q, Count
from django.views import generic
from django.utils.decorators import method_decorator
from django.views.decorators.csrf import csrf_protect
from representatives.models import Chamber, Representative
from representatives_positions.views import PositionFormMixin
......@@ -20,6 +22,10 @@ class HomeView(PositionFormMixin, RepresentativeViewMixin,
generic.TemplateView):
template_name = 'home.html'
@method_decorator(csrf_protect)
def dispatch(self, *args, **kwargs):
return super(HomeView, self).dispatch(*args, **kwargs)
def get_context_data(self, **kwargs):
c = super(HomeView, self).get_context_data(**kwargs)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment