From 46ea80161db19de6f3ff7fb9fb292aac3a6cba26 Mon Sep 17 00:00:00 2001 From: Starthur Date: Tue, 31 May 2022 22:14:11 +0200 Subject: [PATCH] Chack campus before password --- src/events/views/events.py | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/src/events/views/events.py b/src/events/views/events.py index 063e381..16b2db4 100644 --- a/src/events/views/events.py +++ b/src/events/views/events.py @@ -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