Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix cookie parsing #242

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 deletions easyaudit/signals/request_signals.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from django.contrib.auth import get_user_model
from django.contrib.sessions.models import Session
from django.core.signals import request_started
from django.http.cookie import SimpleCookie
from django.http.cookie import parse_cookie
from django.utils import timezone
from django.conf import settings
from django.utils.module_loading import import_string
Expand Down Expand Up @@ -63,11 +63,10 @@ def request_started_handler(sender, **kwargs):
user = None
# get the user from cookies
if not user and cookie_string:
cookie = SimpleCookie()
cookie.load(cookie_string)
cookie = parse_cookie(cookie_string)
session_cookie_name = settings.SESSION_COOKIE_NAME
if session_cookie_name in cookie:
session_id = cookie[session_cookie_name].value
session_id = cookie[session_cookie_name]

try:
session = Session.objects.get(session_key=session_id)
Expand Down