Skip to content

Commit

Permalink
consider attendee code in cookie (#221)
Browse files Browse the repository at this point in the history
Co-authored-by: odkhang <[email protected]>
  • Loading branch information
lcduong and odkhang authored Oct 4, 2024
1 parent 4235cc4 commit cdbc117
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/pretalx/common/middleware/event.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,10 @@ def __init__(self, get_response):
@staticmethod
def _handle_login(request):
# If the user is already authenticated, no need to auto-login
if request.user.is_authenticated:

if request.user.is_authenticated or any(
path in request.path for path in ["/callback", "/signup"]
):
return

# Check for the presence of the SSO token
Expand All @@ -80,6 +83,7 @@ def _handle_login(request):
user.is_staff = payload.get("is_staff", False)
user.locale = payload.get("locale", user.locale)
user.timezone = payload.get("timezone", user.timezone)
user.code = payload.get("customer_identifier", user.code)
user.save()
login(
request, user, backend="django.contrib.auth.backends.ModelBackend"
Expand Down

0 comments on commit cdbc117

Please sign in to comment.