forked from 42CTF/website
Chack campus before password
This commit is contained in:
parent
d222784bb0
commit
46ea80161d
|
@ -1,4 +1,3 @@
|
|||
from pprint import pprint
|
||||
from django.shortcuts import render, get_object_or_404, redirect
|
||||
from django.contrib.auth.decorators import login_required
|
||||
from django.contrib.auth.models import timezone
|
||||
|
@ -111,13 +110,6 @@ def event(request, event_slug):
|
|||
player = None
|
||||
if player:
|
||||
IsRegistered = True
|
||||
if event_info.password:
|
||||
if request.user.is_authenticated:
|
||||
if request.user.is_staff is False:
|
||||
if not player:
|
||||
return render(request, 'events/event_pwd.html', {'event' : event_info, 'logged': True, 'wrongpwd': wrongpwd, 'alreadyregistered': alreadyregistered, 'userHasCampus': True, 'campusCanJoin': True})
|
||||
else:
|
||||
return render(request, 'events/event_pwd.html', {'event' : event_info, 'logged': False, 'wrongpwd': wrongpwd, 'alreadyregistered': alreadyregistered, 'userHasCampus': True, 'campusCanJoin': True})
|
||||
if event_info.campus.all():
|
||||
if request.user.is_authenticated:
|
||||
if request.user.is_staff is False:
|
||||
|
@ -128,6 +120,13 @@ def event(request, event_slug):
|
|||
return render(request, 'events/event_pwd.html', {'event' : event_info, 'logged': True, 'wrongpwd': wrongpwd, 'alreadyregistered': alreadyregistered, 'userHasCampus': True, 'campusCanJoin': False})
|
||||
else:
|
||||
return render(request, 'events/event_pwd.html', {'event' : event_info, 'logged': False, 'wrongpwd': wrongpwd, 'alreadyregistered': alreadyregistered, 'userHasCampus': True, 'campusCanJoin': True})
|
||||
if event_info.password:
|
||||
if request.user.is_authenticated:
|
||||
if request.user.is_staff is False:
|
||||
if not player:
|
||||
return render(request, 'events/event_pwd.html', {'event' : event_info, 'logged': True, 'wrongpwd': wrongpwd, 'alreadyregistered': alreadyregistered, 'userHasCampus': True, 'campusCanJoin': True})
|
||||
else:
|
||||
return render(request, 'events/event_pwd.html', {'event' : event_info, 'logged': False, 'wrongpwd': wrongpwd, 'alreadyregistered': alreadyregistered, 'userHasCampus': True, 'campusCanJoin': True})
|
||||
ended = False
|
||||
if timezone.now() >= event_info.end_date:
|
||||
ended = True
|
||||
|
|
Loading…
Reference in New Issue