Skip to content

Commit

Permalink
πŸš‘ Fix : middleware μ‚¬μš© μ‚­μ œ
Browse files Browse the repository at this point in the history
  • Loading branch information
chaeunho1227 committed May 27, 2024
1 parent 8aa9144 commit 08dc650
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
12 changes: 6 additions & 6 deletions booth/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,10 @@ def censor_content(content):
def get_user_fingerprint(request):
user_agent = request.META.get('HTTP_USER_AGENT', '')
user_ip = request.META.get('REMOTE_ADDR', '')
client_token = request.META.get('client_token', '')
if client_token == None:
return None
raw_fingerprint = f'{user_agent}{user_ip}{client_token}'
# client_token = request.META.get('client_token', '')
# if client_token == None:
# return None
raw_fingerprint = f'{user_agent}{user_ip}'
return hashlib.sha256(raw_fingerprint.encode()).hexdigest()

class BoothFilter(filters.FilterSet):
Expand Down Expand Up @@ -104,8 +104,8 @@ def likes(self, request, pk=None):
booth_id = str(booth.id)

fingerprint = get_user_fingerprint(request)
if fingerprint is None:
return Response({'error': 'μœ μ € 정보λ₯Ό 식별할 수 μ—†μŠ΅λ‹ˆλ‹€.'}, status=status.HTTP_400_BAD_REQUEST)
# if fingerprint is None:
# return Response({'error': 'μœ μ € 정보λ₯Ό 식별할 수 μ—†μŠ΅λ‹ˆλ‹€.'}, status=status.HTTP_400_BAD_REQUEST)

if request.method == 'POST':
if booth_id in request.COOKIES:
Expand Down
2 changes: 1 addition & 1 deletion festival/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware',
'booth.middlewares.ClientTokenMiddleware',
# 'booth.middlewares.ClientTokenMiddleware',
]

ROOT_URLCONF = 'festival.urls'
Expand Down

0 comments on commit 08dc650

Please sign in to comment.