fix(security): ensure csrf cookie is set on frontend template dispatch
Some checks failed
Build, Test, and Deploy / build-and-deploy (push) Failing after 32s
Some checks failed
Build, Test, and Deploy / build-and-deploy (push) Failing after 32s
This commit is contained in:
parent
2ed637eb51
commit
007648fd8b
1 changed files with 7 additions and 1 deletions
|
|
@ -1,6 +1,12 @@
|
|||
from django.contrib import admin
|
||||
from django.urls import path, include, re_path
|
||||
from django.views.decorators.csrf import ensure_csrf_cookie
|
||||
from django.views.generic import TemplateView
|
||||
from django.utils.decorators import method_decorator
|
||||
|
||||
@method_decorator(ensure_csrf_cookie, name='dispatch')
|
||||
class FrontendIndexView(TemplateView):
|
||||
template_name = 'index.html'
|
||||
from rest_framework.routers import DefaultRouter
|
||||
|
||||
from crm_core.views import (
|
||||
|
|
@ -48,5 +54,5 @@ urlpatterns = [
|
|||
'patch': 'partial_update',
|
||||
'delete': 'destroy'
|
||||
}), name='custom_record_detail'),
|
||||
re_path(r'^(?!api/|admin/).*$', TemplateView.as_view(template_name='index.html'), name='frontend'),
|
||||
re_path(r'^(?!api/|admin/).*$', FrontendIndexView.as_view(), name='frontend'),
|
||||
]
|
||||
|
|
|
|||
Loading…
Reference in a new issue