mirror of
https://github.com/encode/django-rest-framework.git
synced 2025-08-05 04:50:12 +03:00
Merge a8566ba1ec
into fd72a814f8
This commit is contained in:
commit
acfa9aafb1
|
@ -134,7 +134,7 @@ class SessionAuthentication(BaseAuthentication):
|
||||||
"""
|
"""
|
||||||
Enforce CSRF validation for session based authentication.
|
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:
|
if reason:
|
||||||
# CSRF failed, bail with explicit error message
|
# CSRF failed, bail with explicit error message
|
||||||
raise exceptions.PermissionDenied('CSRF Failed: %s' % reason)
|
raise exceptions.PermissionDenied('CSRF Failed: %s' % reason)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user