MCPcopy
hub / github.com/django/django / _add_new_csrf_cookie

Function _add_new_csrf_cookie

django/middleware/csrf.py:84–93  ·  view source on GitHub ↗

Generate a new random CSRF_COOKIE value, and add it to request.META.

(request)

Source from the content-addressed store, hash-verified

82
83
84def _add_new_csrf_cookie(request):
85 """Generate a new random CSRF_COOKIE value, and add it to request.META."""
86 csrf_secret = _get_new_csrf_string()
87 request.META.update(
88 {
89 "CSRF_COOKIE": csrf_secret,
90 "CSRF_COOKIE_NEEDS_UPDATE": True,
91 }
92 )
93 return csrf_secret
94
95
96def get_token(request):

Callers 3

get_tokenFunction · 0.85
rotate_tokenFunction · 0.85
process_requestMethod · 0.85

Calls 2

_get_new_csrf_stringFunction · 0.85
updateMethod · 0.45

Tested by

no test coverage detected