mirror of
https://github.com/ArchiveBox/ArchiveBox.git
synced 2025-05-16 16:14:28 -04:00
Exempt /add route from CSRF
This commit is contained in:
parent
66f17cb46b
commit
cdcfb7fa44
1 changed files with 3 additions and 1 deletions
|
@ -11,6 +11,8 @@ from django.views.generic.list import ListView
|
||||||
from django.views.generic import FormView
|
from django.views.generic import FormView
|
||||||
from django.db.models import Q
|
from django.db.models import Q
|
||||||
from django.contrib.auth.mixins import UserPassesTestMixin
|
from django.contrib.auth.mixins import UserPassesTestMixin
|
||||||
|
from django.views.decorators.csrf import csrf_exempt
|
||||||
|
from django.utils.decorators import method_decorator
|
||||||
|
|
||||||
from core.models import Snapshot
|
from core.models import Snapshot
|
||||||
from core.forms import AddLinkForm
|
from core.forms import AddLinkForm
|
||||||
|
@ -236,7 +238,7 @@ class PublicIndexView(ListView):
|
||||||
else:
|
else:
|
||||||
return redirect(f'/admin/login/?next={self.request.path}')
|
return redirect(f'/admin/login/?next={self.request.path}')
|
||||||
|
|
||||||
|
@method_decorator(csrf_exempt, name='dispatch')
|
||||||
class AddView(UserPassesTestMixin, FormView):
|
class AddView(UserPassesTestMixin, FormView):
|
||||||
template_name = "add.html"
|
template_name = "add.html"
|
||||||
form_class = AddLinkForm
|
form_class = AddLinkForm
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue