Skip to content

Commit

Permalink
Exclude front-page submit views from CSRF.
Browse files Browse the repository at this point in the history
  • Loading branch information
dracos committed Feb 14, 2017
1 parent 67f4ee8 commit d48351e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
2 changes: 2 additions & 0 deletions mapit/views/areas.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
from django.core.urlresolvers import resolve, reverse
from django.conf import settings
from django.shortcuts import redirect, render
from django.views.decorators.csrf import csrf_exempt

from mapit.models import Area, Generation, Geometry, Code, Name
from mapit.shortcuts import output_json, output_html, output_polygon, get_object_or_404, set_timeout
Expand Down Expand Up @@ -407,6 +408,7 @@ def areas_by_point_osgb(request, e, n, bb=False, format=''):
return HttpResponseRedirect(redirect_path)


@csrf_exempt
def point_form_submitted(request):
latlon = request.POST.get('pc', None)
if not request.method == 'POST' or not latlon:
Expand Down
2 changes: 2 additions & 0 deletions mapit/views/postcodes.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
from django.contrib.gis.geos import Point
from django.contrib.gis.measure import D
from django.contrib.gis.db.models import Collect
from django.views.decorators.csrf import csrf_exempt

from mapit.models import Postcode, Area, Generation
from mapit.utils import is_valid_postcode, is_valid_partial_postcode
Expand Down Expand Up @@ -140,6 +141,7 @@ def example_postcode_for_area(request, area_id, format='json'):
return output_json(pc)


@csrf_exempt
def form_submitted(request):
pc = request.POST.get('pc', None)
if not request.method == 'POST' or not pc:
Expand Down

0 comments on commit d48351e

Please sign in to comment.