Events done
This commit is contained in:
parent
06dc8188a0
commit
6997aaf93b
|
@ -8,28 +8,28 @@
|
||||||
<h3>Login</h3>
|
<h3>Login</h3>
|
||||||
</div>
|
</div>
|
||||||
<div class="ctf-body">
|
<div class="ctf-body">
|
||||||
<div class="col-sm-8 col-md-6 mx-auto">
|
<div class="col-sm-8 col-md-6 mx-auto">
|
||||||
{% if error %}
|
{% if error %}
|
||||||
<span class="message error-msg">{% trans "Please, verify your infos." %}</span>
|
<span class="message error-msg">{% trans "Please, verify your infos." %}</span>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
<form method="post">
|
<form method="post">
|
||||||
{% csrf_token %}
|
{% csrf_token %}
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<input class="form-control" type="text" name="username" placeholder="{% trans "Username" %}"></br>
|
<input class="form-control" type="text" name="username" placeholder="{% trans "Username" %}"></br>
|
||||||
<input class="form-control" type="password" name="password" placeholder="{% trans "Password" %}"></br>
|
<input class="form-control" type="password" name="password" placeholder="{% trans "Password" %}"></br>
|
||||||
<input class="form-control" type="submit" value="login">
|
<input class="form-control" type="submit" value="login">
|
||||||
</div>
|
</div>
|
||||||
<a href="{% url 'password_reset' %}">{% trans "Reset password" %}</a>
|
<a href="{% url 'password_reset' %}">{% trans "Reset password" %}</a>
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
<div class="col-sm-12 col-md-3 right-sidebar">
|
<div class="col-sm-12 col-md-3 right-sidebar">
|
||||||
<ul class="list-group">
|
<ul class="list-group">
|
||||||
<a href="/accounts/signin" class="list-group-item">{% trans "Login" %}</a>
|
<a href="/accounts/signin" class="list-group-item">{% trans "Login" %}</a>
|
||||||
<a href="/accounts/signup" class="list-group-item">{% trans "Sign up" %}</a>
|
<a href="/accounts/signup" class="list-group-item">{% trans "Sign up" %}</a>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -6,32 +6,46 @@
|
||||||
<div class="ctf-block">
|
<div class="ctf-block">
|
||||||
<a href="{% url 'events:event_info' event_slug=event.slug %}">< Back to event</a>
|
<a href="{% url 'events:event_info' event_slug=event.slug %}">< Back to event</a>
|
||||||
<div class="ctf-head">
|
<div class="ctf-head">
|
||||||
<h2>Event - {{ event.name }}</h2>
|
<h2>{% trans "Event" %} - {{ event.name }}</h2>
|
||||||
<h4>{{ ctf.name }}</h4>
|
<h4>{{ ctf.name }}</h4>
|
||||||
<small>{% trans "Published date" %} : {{ ctf.pub_date }}</small>
|
<small>{% trans "Published date" %} : {{ ctf.pub_date }}</small>
|
||||||
</div>
|
</div>
|
||||||
<div class="ctf-body">
|
<div class="ctf-body">
|
||||||
{% if description %}
|
{% if description %}
|
||||||
{{ description|safe }}
|
{{ description|safe }}
|
||||||
{% else %}
|
{% else %}
|
||||||
{% trans "No translation available. Please try another language (English or French)." %}
|
{% trans "No translation available. Please try another language (English or French)." %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</div>
|
</div>
|
||||||
<div class="ctf-footer">
|
<div class="ctf-footer">
|
||||||
{% if request.user.is_authenticated %}
|
{% if request.user.is_authenticated %}
|
||||||
{% if valitated == True %}
|
|
||||||
<p>{% trans "Congratulation !" %}</p>
|
{% if subisover == True %}
|
||||||
{% elif alvalitated == True %}
|
<span class="message error-msg">{% trans "Subscriptions is over." %}</span>
|
||||||
<p>{% trans "Already flagged" %}</p>
|
{% endif %}
|
||||||
{% if ctf.ctf_url %}
|
{% if alreadyregistered == True %}
|
||||||
<a class="begin-ctf-link" target="_blank" href="{{ ctf.ctf_url }}">{% trans "Start the challenge" %}</a></br>
|
<span class="message error-msg">{% trans "You're already registered to this event." %}</span>
|
||||||
{% elif ctf.file %}
|
{% endif %}
|
||||||
<a class="begin-ctf-link" target="_blank" href="{{ ctf.file.url }}">{% trans "Download" %}</a></br>
|
|
||||||
{% endif %}
|
{% if congrat == True %}
|
||||||
|
<p>{% trans "Congratulation !" %}</p>
|
||||||
|
{% elif alreadyflag == True %}
|
||||||
|
<p>{% trans "Already flagged" %}</p>
|
||||||
|
{% elif eventisover == True %}
|
||||||
|
<p>{% trans "This event is over." %}</p>
|
||||||
|
{% elif errorform == True %}
|
||||||
|
<p>{% trans "Error while processing your request. (Invalid Form)" %}</p>
|
||||||
|
{% elif notsub == True %}
|
||||||
|
<span class="message error-msg">{% trans "Error: you're not registered to this event, so you can't register scores, fucking logic." %}</span>
|
||||||
|
{% if ctf.ctf_url %}
|
||||||
|
<a class="begin-ctf-link" target="_blank" href="{{ ctf.ctf_url }}">{% trans "Start the challenge" %}</a></br>
|
||||||
|
{% elif ctf.file %}
|
||||||
|
<a class="begin-ctf-link" target="_blank" href="{{ ctf.file.url }}">{% trans "Download" %}</a></br>
|
||||||
|
{% endif %}
|
||||||
{% else %}
|
{% else %}
|
||||||
{% if failed %}
|
{% if wrongflag == True %}
|
||||||
<p>{% trans "Wrong flag ! You can do it !" %}</p>
|
<p>{% trans "Wrong flag ! You can do it !" %}</p>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% if ctf.ctf_url %}
|
{% if ctf.ctf_url %}
|
||||||
<a class="begin-ctf-link" target="_blank" href="{{ ctf.ctf_url }}">{% trans "Start the challenge" %}</a></br>
|
<a class="begin-ctf-link" target="_blank" href="{{ ctf.ctf_url }}">{% trans "Start the challenge" %}</a></br>
|
||||||
{% elif ctf.file %}
|
{% elif ctf.file %}
|
||||||
|
|
|
@ -4,8 +4,14 @@
|
||||||
{% load is_flagged %}
|
{% load is_flagged %}
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-sm-12 col-md-9">
|
<div class="col-sm-12 col-md-9">
|
||||||
<div class="ctf-block">
|
{% if subisover == True %}
|
||||||
<div class="ctf-head">
|
<span class="message error-msg">{% trans "Subscriptions is over." %}</span>
|
||||||
|
{% endif %}
|
||||||
|
{% if alreadyregistered == True %}
|
||||||
|
<span class="message error-msg">{% trans "You're already registered to this event." %}</span>
|
||||||
|
{% endif %}
|
||||||
|
<div class="event-block">
|
||||||
|
<div class="event-head">
|
||||||
<h3>{{ event.name }}</h3>
|
<h3>{{ event.name }}</h3>
|
||||||
{% if ended == True %}
|
{% if ended == True %}
|
||||||
<small>{% trans "This event is over." %}</small>
|
<small>{% trans "This event is over." %}</small>
|
||||||
|
@ -13,33 +19,33 @@
|
||||||
<small>{% trans "This event start at" %} : {{ event.start_date }}</small>
|
<small>{% trans "This event start at" %} : {{ event.start_date }}</small>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</div>
|
</div>
|
||||||
<div class="ctf-body">
|
<div class="event-body">
|
||||||
{% if event.description %}
|
{% if event.description %}
|
||||||
{{ event.description|safe }}
|
{{ event.description|safe }}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</div>
|
</div>
|
||||||
<div class="ctf-footer">
|
<div class="event-footer">
|
||||||
{% if begun == True %}
|
{% if begun == True %}
|
||||||
<h4>{% trans "Challenges" %}</h4>
|
<h4>{% trans "Challenges" %}</h4>
|
||||||
|
|
||||||
<div class="row">
|
|
||||||
{% if ctfs %}
|
{% if ctfs %}
|
||||||
{% for ctf in ctfs %}
|
<div class="row">
|
||||||
<div class="col-md-4">
|
{% for ctf in ctfs %}
|
||||||
{% isflagged request.user ctf as flagged%}
|
<div class="col-md-4">
|
||||||
<a href="{% url 'events:event_chall_info' event_slug=event.slug chall_slug=ctf.slug %}">
|
{% isflagged request.user ctf as flagged%}
|
||||||
<div class="chall-card {{flagged}}">
|
<a href="{% url 'events:event_chall_info' event_slug=event.slug chall_slug=ctf.slug %}">
|
||||||
<p>{{ ctf.category }}</p>
|
<div class="chall-card {{flagged}}">
|
||||||
<p>{{ ctf.name }} - {{ ctf.points }}</p>
|
<p>{{ ctf.category }}</p>
|
||||||
</div>
|
<p>{{ ctf.name }} - {{ ctf.points }}</p>
|
||||||
</a>
|
</div>
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
{% endfor %}
|
||||||
</div>
|
</div>
|
||||||
{% endfor %}
|
{% else %}
|
||||||
|
<small>{% trans "No challenges available." %}</small>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</div>
|
|
||||||
{% if request.user.is_authenticated %}
|
|
||||||
|
|
||||||
{% endif %}
|
|
||||||
{% else %}
|
{% else %}
|
||||||
<h4>{% trans "The event has not started yet." %}</h4>
|
<h4>{% trans "The event has not started yet." %}</h4>
|
||||||
|
|
||||||
|
@ -72,7 +78,7 @@
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
{% else %}
|
{% else %}
|
||||||
<p>{% trans "Nobody have solved this CTF." %}</p>
|
<p>{% trans "No one have earn point yet, you gonna be the first ?" %}</p>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -11,13 +11,19 @@
|
||||||
|
|
||||||
<div class="ctf-footer">
|
<div class="ctf-footer">
|
||||||
{% if logged == True %}
|
{% if logged == True %}
|
||||||
<h4>{% trans "This event is password protected" %}</h4>
|
{% if wrongpwd == True %}
|
||||||
<small>{% trans "You need to submit the event password to gain access to this event." %}</small>
|
<span class="message error-msg">{% trans "Wrong password submited." %}</span>
|
||||||
<form method="post" action="{% url 'events:submit_pwd' event_slug=event.slug %}" class="submitflag-form">
|
{% endif %}
|
||||||
{% csrf_token %}
|
{% if alreadyregistered == True %}
|
||||||
<input type="text" name="password" maxlength="48" required="">
|
<span class="message error-msg">{% trans "You're already registered to this event." %}</span>
|
||||||
<input class="form-control" type="submit" value=">">
|
{% endif %}
|
||||||
</form>
|
<h4>{% trans "This event is password protected" %}</h4>
|
||||||
|
<small>{% trans "You need to submit the event password to gain access to this event." %}</small>
|
||||||
|
<form method="post" action="{% url 'events:submit_pwd' event_slug=event.slug %}" class="submitflag-form">
|
||||||
|
{% csrf_token %}
|
||||||
|
<input type="text" name="password" maxlength="48" required="">
|
||||||
|
<input class="form-control" type="submit" value=">">
|
||||||
|
</form>
|
||||||
{% else %}
|
{% else %}
|
||||||
<h4>{% trans "You need to be logged to access this event." %}</h4>
|
<h4>{% trans "You need to be logged to access this event." %}</h4>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
|
@ -3,14 +3,10 @@
|
||||||
{% load i18n %}
|
{% load i18n %}
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-12">
|
<div class="col-12">
|
||||||
<h3>Events</h3>
|
<h3>{% trans "Events" %}</h3>
|
||||||
</div>
|
</div>
|
||||||
{% if events %}
|
{% if events %}
|
||||||
{% for ev in events %}
|
{% for ev in events %}
|
||||||
{% if request.user.is_authenticated %}
|
|
||||||
|
|
||||||
{% else %}
|
|
||||||
{% endif %}
|
|
||||||
{% if curdate > ev.end_date %}
|
{% if curdate > ev.end_date %}
|
||||||
<div class="col-md-3 is-over">
|
<div class="col-md-3 is-over">
|
||||||
{% else %}
|
{% else %}
|
||||||
|
@ -23,17 +19,23 @@
|
||||||
alt="..."
|
alt="..."
|
||||||
/>
|
/>
|
||||||
<div class="card-body">
|
<div class="card-body">
|
||||||
<h5 class="card-title">{{ ev.name }}</h5>
|
<h5 class="card-title">
|
||||||
<p class="card-text">
|
{{ ev.name }}
|
||||||
Some quick example text to build on the card title and make up the bulk of the
|
</h5>
|
||||||
card's content.
|
|
||||||
</p>
|
|
||||||
</div>
|
</div>
|
||||||
<ul class="list-group list-group-flush text-center">
|
<ul class="list-group list-group-flush text-center">
|
||||||
<li class="list-group-item">{{ ev.start_date }} <br> - <br> {{ ev.end_date }}</li>
|
<li class="list-group-item">
|
||||||
|
{{ ev.start_date }} <br> - <br> {{ ev.end_date }}
|
||||||
|
<br>
|
||||||
|
{% if curdate > ev.end_date %}
|
||||||
|
<span class="badge badge-pill badge-secondary">Finished</span>
|
||||||
|
{% else %}
|
||||||
|
<span class="badge badge-pill badge-success">Open</span>
|
||||||
|
{% endif %}
|
||||||
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
<div class="card-body text-center">
|
<div class="card-body text-center">
|
||||||
<a href="{% url 'events:event_info' event_slug=ev.slug %}" class="card-link">See more</a>
|
<a href="{% url 'events:event_info' event_slug=ev.slug %}" class="card-link">{% trans "See more" %}</a>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -27,17 +27,44 @@ def events(request):
|
||||||
def chall_event_info(request, event_slug, chall_slug):
|
def chall_event_info(request, event_slug, chall_slug):
|
||||||
event_info = get_object_or_404(Event, slug=event_slug)
|
event_info = get_object_or_404(Event, slug=event_slug)
|
||||||
ctf_info = get_object_or_404(CTF, event__slug=event_info.slug, slug=chall_slug)
|
ctf_info = get_object_or_404(CTF, event__slug=event_info.slug, slug=chall_slug)
|
||||||
|
eventisover = False
|
||||||
|
alreadyflag = False
|
||||||
|
congrat = False
|
||||||
|
wrongflag = False
|
||||||
|
errorform = False
|
||||||
|
notsub = False
|
||||||
if request.user.is_authenticated and not request.user.is_staff:
|
if request.user.is_authenticated and not request.user.is_staff:
|
||||||
userScore = Scores.objects.filter(event=event_info, user=request.user)
|
userScore = Scores.objects.filter(event=event_info, user=request.user)
|
||||||
if not userScore:
|
if not userScore:
|
||||||
return redirect('/')
|
return redirect('/')
|
||||||
|
if request.GET.get('EventIsOver'):
|
||||||
|
eventisover = True
|
||||||
|
if request.GET.get('AlreadyFlagged'):
|
||||||
|
alreadyflag = True
|
||||||
|
if request.GET.get('Congrat'):
|
||||||
|
congrat = True
|
||||||
|
if request.GET.get('WrongFlag'):
|
||||||
|
wrongflag = True
|
||||||
|
if request.GET.get('ErrorInForm'):
|
||||||
|
errorform = True
|
||||||
|
if request.GET.get('NotRegistered'):
|
||||||
|
notsub = True
|
||||||
solved_list = CTF_flags.objects.filter(ctf=ctf_info).order_by('flag_date')
|
solved_list = CTF_flags.objects.filter(ctf=ctf_info).order_by('flag_date')
|
||||||
description = get_description_by_lang(ctf_info)
|
description = get_description_by_lang(ctf_info)
|
||||||
return render(request, 'events/ctf_info.html', { 'ctf' : ctf_info, 'event':event_info, 'solved_list': solved_list, 'description': description})
|
return render(request, 'events/ctf_info.html', { 'ctf' : ctf_info, 'event':event_info, 'solved_list': solved_list, 'description': description, 'eventisover': eventisover, 'alreadyflag': alreadyflag, 'congrat': congrat, 'wrongflag': wrongflag, 'errorform': errorform, 'notsub': notsub})
|
||||||
|
|
||||||
def event(request, event_slug):
|
def event(request, event_slug):
|
||||||
event_info = get_object_or_404(Event, slug=event_slug)
|
event_info = get_object_or_404(Event, slug=event_slug)
|
||||||
IsRegistered = False
|
IsRegistered = False
|
||||||
|
wrongpwd = False
|
||||||
|
alreadyregistered = False
|
||||||
|
subisover = False
|
||||||
|
if request.GET.get('WrongPassword'):
|
||||||
|
wrongpwd = True
|
||||||
|
if request.GET.get('AlreadyRegistered'):
|
||||||
|
alreadyregistered = True
|
||||||
|
if request.GET.get('SubscriptionIsOver'):
|
||||||
|
subisover = True
|
||||||
if request.user.is_authenticated:
|
if request.user.is_authenticated:
|
||||||
userScore = Scores.objects.filter(event=event_info, user=request.user)
|
userScore = Scores.objects.filter(event=event_info, user=request.user)
|
||||||
if userScore:
|
if userScore:
|
||||||
|
@ -46,9 +73,9 @@ def event(request, event_slug):
|
||||||
if request.user.is_authenticated:
|
if request.user.is_authenticated:
|
||||||
if request.user.is_staff is False:
|
if request.user.is_staff is False:
|
||||||
if not userScore:
|
if not userScore:
|
||||||
return render(request, 'events/event_pwd.html', {'event' : event_info, 'logged': True})
|
return render(request, 'events/event_pwd.html', {'event' : event_info, 'logged': True, 'wrongpwd': wrongpwd, 'alreadyregistered': alreadyregistered})
|
||||||
else:
|
else:
|
||||||
return render(request, 'events/event_pwd.html', {'event' : event_info, 'logged': False})
|
return render(request, 'events/event_pwd.html', {'event' : event_info, 'logged': False, 'wrongpwd': wrongpwd, 'alreadyregistered': alreadyregistered})
|
||||||
ended = False
|
ended = False
|
||||||
if timezone.now() >= event_info.end_date:
|
if timezone.now() >= event_info.end_date:
|
||||||
ended = True
|
ended = True
|
||||||
|
@ -57,25 +84,25 @@ def event(request, event_slug):
|
||||||
begun = True
|
begun = True
|
||||||
challenges = CTF.objects.filter(event=event_info).order_by('category', 'points')
|
challenges = CTF.objects.filter(event=event_info).order_by('category', 'points')
|
||||||
solved_list = Scores.objects.filter(event=event_info).order_by('-score', 'last_submission_date', 'user__username')
|
solved_list = Scores.objects.filter(event=event_info).order_by('-score', 'last_submission_date', 'user__username')
|
||||||
return render(request, 'events/event_info.html', {'event' : event_info, 'IsRegistered': IsRegistered, 'ctfs': challenges, 'solved_list':solved_list, 'ended': ended, 'begun': begun})
|
return render(request, 'events/event_info.html', {'event' : event_info, 'IsRegistered': IsRegistered, 'ctfs': challenges, 'solved_list':solved_list, 'ended': ended, 'begun': begun, 'wrongpwd': wrongpwd, 'alreadyregistered': alreadyregistered, 'subisover': subisover})
|
||||||
|
|
||||||
@login_required
|
@login_required
|
||||||
def submit_event_flag(request, event_slug, chall_slug):
|
def submit_event_flag(request, event_slug, chall_slug):
|
||||||
ev = get_object_or_404(Event, slug=event_slug)
|
ev = get_object_or_404(Event, slug=event_slug)
|
||||||
response = redirect('events:event_chall_info', event_slug=event_slug, chall_slug=chall_slug)
|
response = redirect('events:event_chall_info', event_slug=event_slug, chall_slug=chall_slug)
|
||||||
if timezone.now() >= ev.end_date:
|
if timezone.now() >= ev.end_date:
|
||||||
response['Location'] += '?EventIsOver'
|
response['Location'] += '?EventIsOver=1'
|
||||||
return response
|
return response
|
||||||
|
|
||||||
if request.method == 'POST':
|
if request.method == 'POST':
|
||||||
ctf_info = CTF.objects.get(event=ev, slug=chall_slug)
|
ctf_info = CTF.objects.get(event=ev, slug=chall_slug)
|
||||||
if not ctf_info:
|
if not ctf_info:
|
||||||
response['Location'] += '?ChallengeNotFound'
|
response['Location'] += '?ChallengeNotFound=1'
|
||||||
return response
|
return response
|
||||||
flagged = False
|
flagged = False
|
||||||
if CTF_flags.objects.filter(user=request.user, ctf=ctf_info):
|
if CTF_flags.objects.filter(user=request.user, ctf=ctf_info):
|
||||||
flagged = True
|
flagged = True
|
||||||
response['Location'] += '?AlreadyFlagged'
|
response['Location'] += '?AlreadyFlagged=1'
|
||||||
return response
|
return response
|
||||||
try:
|
try:
|
||||||
score = Scores.objects.get(user=request.user, event=ev)
|
score = Scores.objects.get(user=request.user, event=ev)
|
||||||
|
@ -90,14 +117,17 @@ def submit_event_flag(request, event_slug, chall_slug):
|
||||||
score.last_submission_date = timezone.now()
|
score.last_submission_date = timezone.now()
|
||||||
score.score += ctf_info.points
|
score.score += ctf_info.points
|
||||||
score.save()
|
score.save()
|
||||||
response['Location'] += '?Congrat'
|
response['Location'] += '?Congrat=1'
|
||||||
return response
|
return response
|
||||||
else:
|
else:
|
||||||
response['Location'] += '?WrongFlag'
|
response['Location'] += '?WrongFlag=1'
|
||||||
return response
|
return response
|
||||||
else:
|
else:
|
||||||
response['Location'] += '?ErrorInForm'
|
response['Location'] += '?ErrorInForm=1'
|
||||||
return response
|
return response
|
||||||
|
else:
|
||||||
|
response['Location'] += '?NotRegistered=1'
|
||||||
|
return response
|
||||||
return response
|
return response
|
||||||
|
|
||||||
@login_required
|
@login_required
|
||||||
|
@ -107,15 +137,15 @@ def submit_pwd(request, event_slug):
|
||||||
if request.user.is_authenticated:
|
if request.user.is_authenticated:
|
||||||
ev = get_object_or_404(Event, slug=event_slug)
|
ev = get_object_or_404(Event, slug=event_slug)
|
||||||
if ev == False:
|
if ev == False:
|
||||||
response['Location'] += '?NoEventFound'
|
response['Location'] += '?NoEventFound=1'
|
||||||
return response
|
return response
|
||||||
|
|
||||||
if request.POST.get('password') != ev.password:
|
if request.POST.get('password') != ev.password:
|
||||||
response['Location'] += '?WrongPassword'
|
response['Location'] += '?WrongPassword=1'
|
||||||
return response
|
return response
|
||||||
|
|
||||||
if Scores.objects.filter(user=request.user, event=ev).exists():
|
if Scores.objects.filter(user=request.user, event=ev).exists():
|
||||||
response['Location'] += '?AlreadyRegistered'
|
response['Location'] += '?AlreadyRegistered=1'
|
||||||
return response
|
return response
|
||||||
else:
|
else:
|
||||||
new = Scores(user=request.user, event=ev, score=0)
|
new = Scores(user=request.user, event=ev, score=0)
|
||||||
|
@ -129,13 +159,13 @@ def subscribe_to_event(request, event_slug):
|
||||||
if request.user.is_authenticated:
|
if request.user.is_authenticated:
|
||||||
ev = get_object_or_404(Event, slug=event_slug)
|
ev = get_object_or_404(Event, slug=event_slug)
|
||||||
if ev == False:
|
if ev == False:
|
||||||
response['Location'] += '?NoEventFound'
|
response['Location'] += '?NoEventFound=1'
|
||||||
return response
|
return response
|
||||||
if timezone.now() >= ev.end_date:
|
if timezone.now() >= ev.end_date:
|
||||||
response['Location'] += '?SubscriptionIsOver'
|
response['Location'] += '?SubscriptionIsOver=1'
|
||||||
return response
|
return response
|
||||||
if Scores.objects.filter(user=request.user, event=ev).exists():
|
if Scores.objects.filter(user=request.user, event=ev).exists():
|
||||||
response['Location'] += '?AlreadyRegistered'
|
response['Location'] += '?AlreadyRegistered=1'
|
||||||
return response
|
return response
|
||||||
else:
|
else:
|
||||||
new = Scores(user=request.user, event=ev, score=0)
|
new = Scores(user=request.user, event=ev, score=0)
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
body {background-color: #121212;color: #D9D9D9}
|
body {background-color: #121212;color: #D9D9D9}
|
||||||
.card-body {background-color: #1D1D1D;}
|
.card-body {background-color: #1D1D1D;}
|
||||||
|
a{color:#cecece;}
|
||||||
|
a:hover{color:#a9a9a9;text-decoration: none;}
|
||||||
.main-div{margin-top: 40px;}
|
.main-div{margin-top: 40px;}
|
||||||
footer {text-align: center;}
|
footer {text-align: center;}
|
||||||
.news-card {margin-bottom: 20px; border: none;}
|
.news-card {margin-bottom: 20px; border: none;}
|
||||||
|
@ -27,6 +29,9 @@ pre {background-color: #000; color: #cecece; padding-left: 15px; font-weight: bo
|
||||||
.ctf-body {margin-top: 50px;}
|
.ctf-body {margin-top: 50px;}
|
||||||
.bloc-body {margin-top: 25px;}
|
.bloc-body {margin-top: 25px;}
|
||||||
.ctf-footer {margin-top: 15px;text-align: center;}
|
.ctf-footer {margin-top: 15px;text-align: center;}
|
||||||
|
.event-block{background-color: #1D1D1D; min-height: 235px; margin-bottom: 20px;}
|
||||||
|
.event-body {padding:15px;margin-top: 50px;}
|
||||||
|
.event-footer{margin-top: 15px;text-align: center; padding: 15px;}
|
||||||
input[type=text], input[type=password], input[type=url], input[type=email] {transition: 0.2s;border: 2px solid #2d2d2d;background-color: #2d2d2d;padding: 3px; border-radius: 4px;}
|
input[type=text], input[type=password], input[type=url], input[type=email] {transition: 0.2s;border: 2px solid #2d2d2d;background-color: #2d2d2d;padding: 3px; border-radius: 4px;}
|
||||||
input[type=submit] {padding: 0px; margin-left: 5px; border-bottom: 3px solid #000;}
|
input[type=submit] {padding: 0px; margin-left: 5px; border-bottom: 3px solid #000;}
|
||||||
.begin-ctf-link {display:inline-block;margin-bottom: 15px;text-align:center;text-transform: uppercase;text-decoration:none;font-weight: bold;color:#fff;background-color:#121212; width: 125px; border-bottom: 3px solid #000;padding:5px;}
|
.begin-ctf-link {display:inline-block;margin-bottom: 15px;text-align:center;text-transform: uppercase;text-decoration:none;font-weight: bold;color:#fff;background-color:#121212; width: 125px; border-bottom: 3px solid #000;padding:5px;}
|
||||||
|
@ -41,9 +46,35 @@ input[type=submit]:hover {background-color:#000}
|
||||||
.submitflag-form input[type=submit]:hover {background-color:#000}
|
.submitflag-form input[type=submit]:hover {background-color:#000}
|
||||||
.edit-infos-grp input{width: 100%;}
|
.edit-infos-grp input{width: 100%;}
|
||||||
.message {display: block; padding:5px; text-align:center;margin-bottom: 10px;}
|
.message {display: block; padding:5px; text-align:center;margin-bottom: 10px;}
|
||||||
.success-msg {background-color: #42b35e4f;}
|
.success-msg {background-color: #42b35e4f!important;}
|
||||||
.error-msg {background-color: #9542428c;}
|
.error-msg {background-color: #9542428c;}
|
||||||
.progress {background-color: #2d2d2d;color:#000}
|
.progress {background-color: #2d2d2d;}
|
||||||
.bg-success {
|
.bg-success {
|
||||||
background-color: #d9d9d9 !important;
|
background-color: #d9d9d9 !important;color: #000;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.event-card {
|
||||||
|
background-color: #1d1d1d;
|
||||||
|
min-height: 30vh;
|
||||||
|
margin-bottom: 13.37px;
|
||||||
|
}
|
||||||
|
.card-img-top{
|
||||||
|
height:150px;
|
||||||
|
}
|
||||||
|
.chall-card{
|
||||||
|
background-color: #131313;
|
||||||
|
min-height: 100px;
|
||||||
|
border-radius: 2px;
|
||||||
|
margin-bottom: 13.37px;
|
||||||
|
}
|
||||||
|
.is-over {opacity: 50%;}
|
||||||
|
.event-head{
|
||||||
|
background-image:
|
||||||
|
linear-gradient(180deg, rgba(102,102,102,0.48501407398897056) 0%, rgba(29,29,29,1) 100%),
|
||||||
|
url('https://media.lesechos.com/api/v1/images/view/616957f83e45460bec299207/1280x720-webp/0611458970965-web-tete.webp');
|
||||||
|
height: 20vh;
|
||||||
|
background-size: cover;
|
||||||
|
color: white;
|
||||||
|
padding: 20px;
|
||||||
|
padding-top: 40px;
|
||||||
|
}
|
|
@ -29,6 +29,9 @@ pre {background-color: #000; color: #cecece; padding-left: 15px; font-weight: bo
|
||||||
.ctf-body {margin-top: 50px;}
|
.ctf-body {margin-top: 50px;}
|
||||||
.bloc-body {margin-top: 25px;}
|
.bloc-body {margin-top: 25px;}
|
||||||
.ctf-footer {margin-top: 15px;text-align: center;}
|
.ctf-footer {margin-top: 15px;text-align: center;}
|
||||||
|
.event-block{background-color: #1D1D1D; min-height: 235px; margin-bottom: 20px;}
|
||||||
|
.event-body {padding:15px;margin-top: 50px;}
|
||||||
|
.event-footer{margin-top: 15px;text-align: center; padding: 15px;}
|
||||||
input[type=text], input[type=password], input[type=url], input[type=email] {transition: 0.2s;border: 2px solid #2d2d2d;background-color: #2d2d2d;padding: 3px; border-radius: 4px;}
|
input[type=text], input[type=password], input[type=url], input[type=email] {transition: 0.2s;border: 2px solid #2d2d2d;background-color: #2d2d2d;padding: 3px; border-radius: 4px;}
|
||||||
input[type=submit] {padding: 0px; margin-left: 5px; border-bottom: 3px solid #000;}
|
input[type=submit] {padding: 0px; margin-left: 5px; border-bottom: 3px solid #000;}
|
||||||
.begin-ctf-link {display:inline-block;margin-bottom: 15px;text-align:center;text-transform: uppercase;text-decoration:none;font-weight: bold;color:#fff;background-color:#121212; width: 125px; border-bottom: 3px solid #000;padding:5px;}
|
.begin-ctf-link {display:inline-block;margin-bottom: 15px;text-align:center;text-transform: uppercase;text-decoration:none;font-weight: bold;color:#fff;background-color:#121212; width: 125px; border-bottom: 3px solid #000;padding:5px;}
|
||||||
|
@ -52,7 +55,7 @@ input[type=submit]:hover {background-color:#000}
|
||||||
|
|
||||||
.event-card {
|
.event-card {
|
||||||
background-color: #1d1d1d;
|
background-color: #1d1d1d;
|
||||||
min-height: 50vh;
|
min-height: 30vh;
|
||||||
margin-bottom: 13.37px;
|
margin-bottom: 13.37px;
|
||||||
}
|
}
|
||||||
.card-img-top{
|
.card-img-top{
|
||||||
|
@ -64,4 +67,14 @@ input[type=submit]:hover {background-color:#000}
|
||||||
border-radius: 2px;
|
border-radius: 2px;
|
||||||
margin-bottom: 13.37px;
|
margin-bottom: 13.37px;
|
||||||
}
|
}
|
||||||
.is-over {opacity: 50%;}
|
.is-over {opacity: 50%;}
|
||||||
|
.event-head{
|
||||||
|
background-image:
|
||||||
|
linear-gradient(180deg, rgba(102,102,102,0.48501407398897056) 0%, rgba(29,29,29,1) 100%),
|
||||||
|
url('https://media.lesechos.com/api/v1/images/view/616957f83e45460bec299207/1280x720-webp/0611458970965-web-tete.webp');
|
||||||
|
height: 20vh;
|
||||||
|
background-size: cover;
|
||||||
|
color: white;
|
||||||
|
padding: 20px;
|
||||||
|
padding-top: 40px;
|
||||||
|
}
|
Loading…
Reference in New Issue