forked from 42CTF/website
removed 500 when user is not connected and want to access public event
This commit is contained in:
parent
39d10437f8
commit
c360457152
|
@ -9,6 +9,8 @@ def isflagged(user, ctf):
|
|||
flagged = False
|
||||
event_info = ctf.event
|
||||
|
||||
if user.is_authenticated == False:
|
||||
return ""
|
||||
if event_info.team_size == 1:
|
||||
if CTF_flags.objects.filter(user=user, ctf=ctf):
|
||||
flagged = True
|
||||
|
|
|
@ -223,9 +223,9 @@ def subscribe_to_event(request, event_slug):
|
|||
@login_required
|
||||
def create_team(request, event_slug):
|
||||
response = redirect('events:create_team', event_slug=event_slug)
|
||||
if request.method == 'POST':
|
||||
if request.user.is_authenticated:
|
||||
ev = get_object_or_404(Event, slug=event_slug)
|
||||
if request.method == 'POST':
|
||||
if request.user.is_authenticated and ev.team_size > 1:
|
||||
if Team.objects.filter(name=request.POST.get('teamname'), event=ev).exists():
|
||||
return render(request, 'events/create_team.html', {'event' : ev, 'logged': True, 'wrongpwd': False, 'registered' : True, 'exist' : True})
|
||||
new = Team(name=request.POST.get('teamname'), password=request.POST.get('password'), event=ev)
|
||||
|
@ -238,9 +238,9 @@ def create_team(request, event_slug):
|
|||
@login_required
|
||||
def join_team(request, event_slug):
|
||||
response = redirect('events:join_team', event_slug=event_slug)
|
||||
if request.method == 'POST':
|
||||
if request.user.is_authenticated:
|
||||
ev = get_object_or_404(Event, slug=event_slug)
|
||||
if request.method == 'POST':
|
||||
if request.user.is_authenticated and ev.team_size > 1:
|
||||
try:
|
||||
team = Team.objects.get(name=request.POST.get('teamname'), event=ev)
|
||||
except:
|
||||
|
|
Loading…
Reference in New Issue