Skip to content

Commit

Permalink
Also fix login redirect for ongoing hunts
Browse files Browse the repository at this point in the history
  • Loading branch information
dlareau committed Mar 22, 2020
1 parent 4785d04 commit 6003344
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions huntserver/hunt_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
from django.utils import timezone
from django.utils.encoding import smart_str
from django.db.models import F
from django.urls import reverse_lazy
import json
import os
import re
Expand Down Expand Up @@ -91,7 +92,7 @@ def hunt(request, hunt_num):
elif(hunt.is_open):
# see if the team does not belong to the hunt being accessed
if (not request.user.is_authenticated):
return redirect('%s?next=%s' % (settings.LOGIN_URL, request.path))
return redirect('%s?next=%s' % (reverse_lazy(settings.LOGIN_URL), request.path))

elif(team is None or (team.hunt != hunt)):
return render(request, 'access_error.html', {'reason': "team"})
Expand Down Expand Up @@ -263,7 +264,7 @@ def puzzle_view(request, puzzle_id):
# Only allowed access if the hunt is public or if unlocked by team
if(not puzzle.hunt.is_public):
if(not request.user.is_authenticated):
return redirect('%s?next=%s' % (settings.LOGIN_URL, request.path))
return redirect('%s?next=%s' % (reverse_lazy(settings.LOGIN_URL), request.path))

if (not request.user.is_staff):
if(team is None or puzzle not in team.unlocked.all()):
Expand Down

0 comments on commit 6003344

Please sign in to comment.