您最多能選擇 25 個主題
主題必須以字母或數字為開頭,可包含連接號「-」且最長為 35 個字元。
10 行
391 B
10 行
391 B
from django.utils.deprecation import MiddlewareMixin
|
|
|
|
|
|
class SameSiteMiddleware(MiddlewareMixin):
|
|
def process_response(self, request, response):
|
|
if 'sessionid' in response.cookies:
|
|
response.cookies['sessionid']['samesite'] = 'Strict'
|
|
if 'csrftoken' in response.cookies:
|
|
response.cookies['csrftoken']['samesite'] = 'Strict'
|
|
return response
|
|
|