Don't throw a 500 error when verifying csrf token on a session without a cookie
This commit is contained in:
parent
36ba966da7
commit
6ca8c22569
1 changed files with 1 additions and 1 deletions
|
@ -28,7 +28,7 @@ def verify_csrf(token_key='csrftoken'):
|
|||
def wrap_view(view_func):
|
||||
def check_csrf_token(request, *args, **kwargs):
|
||||
csrf_token = _sanitize_token(request.GET.get(token_key, ''))
|
||||
match = _compare_salted_tokens(csrf_token, request.COOKIES[settings.CSRF_COOKIE_NAME])
|
||||
match = _compare_salted_tokens(csrf_token, request.COOKIES.get(settings.CSRF_COOKIE_NAME, ''))
|
||||
if not match:
|
||||
raise PermissionDenied
|
||||
else:
|
||||
|
|
Loading…
Reference in a new issue