mirror of
https://github.com/encode/django-rest-framework.git
synced 2025-08-05 04:50:12 +03:00
Passing the View
to CSRFCheck().process_view()
. Fixes #2376.
This commit is contained in:
parent
d3b2302588
commit
a8566ba1ec
|
@ -126,7 +126,7 @@ class SessionAuthentication(BaseAuthentication):
|
|||
"""
|
||||
Enforce CSRF validation for session based authentication.
|
||||
"""
|
||||
reason = CSRFCheck().process_view(request, None, (), {})
|
||||
reason = CSRFCheck().process_view(request, request.resolver_match[0] if hasattr(request, 'resolver_match') else None, (), {})
|
||||
if reason:
|
||||
# CSRF failed, bail with explicit error message
|
||||
raise exceptions.PermissionDenied('CSRF Failed: %s' % reason)
|
||||
|
|
Loading…
Reference in New Issue
Block a user