mirror of
https://github.com/encode/django-rest-framework.git
synced 2025-02-03 05:04:31 +03:00
Merge pull request #1896 from dbrgn/csrf_response
Changed return status for CSRF failures to HTTP 403
This commit is contained in:
commit
aa84432f9b
|
@ -129,7 +129,7 @@ class SessionAuthentication(BaseAuthentication):
|
||||||
reason = CSRFCheck().process_view(request, None, (), {})
|
reason = CSRFCheck().process_view(request, None, (), {})
|
||||||
if reason:
|
if reason:
|
||||||
# CSRF failed, bail with explicit error message
|
# CSRF failed, bail with explicit error message
|
||||||
raise exceptions.AuthenticationFailed('CSRF Failed: %s' % reason)
|
raise exceptions.PermissionDenied('CSRF Failed: %s' % reason)
|
||||||
|
|
||||||
|
|
||||||
class TokenAuthentication(BaseAuthentication):
|
class TokenAuthentication(BaseAuthentication):
|
||||||
|
|
Loading…
Reference in New Issue
Block a user