forked from 42CTF/website
little fix for flag length + restrict access for unpublished challenges
This commit is contained in:
parent
8ae6d83450
commit
e774921c52
|
@ -8,6 +8,11 @@
|
||||||
<h3>{{ ctf.name }}</h3>
|
<h3>{{ ctf.name }}</h3>
|
||||||
<small>{% trans "Published date" %} : {{ ctf.pub_date }}</small>
|
<small>{% trans "Published date" %} : {{ ctf.pub_date }}</small>
|
||||||
</div>
|
</div>
|
||||||
|
{% if date < ctf.pub_date %}
|
||||||
|
<div class="ctf-body">
|
||||||
|
{% trans "Challenge is not yet available." %}
|
||||||
|
</div>
|
||||||
|
{% else %}
|
||||||
<div class="ctf-body">
|
<div class="ctf-body">
|
||||||
{% if description %}
|
{% if description %}
|
||||||
{{ description|safe }}
|
{{ description|safe }}
|
||||||
|
@ -37,13 +42,14 @@
|
||||||
{% endif %}
|
{% endif %}
|
||||||
<form method="post" class="submitflag-form">
|
<form method="post" class="submitflag-form">
|
||||||
{% csrf_token %}
|
{% csrf_token %}
|
||||||
<input type="text" name="flag" maxlength="48" required="" id="id_flag">
|
<input type="text" name="flag" maxlength="100" required="" id="id_flag">
|
||||||
<input class="form-control" type="submit" value=">">
|
<input class="form-control" type="submit" value=">">
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</div>
|
</div>
|
||||||
|
{% endif %}
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<h4>{% trans "Solved by" %}</h4>
|
<h4>{% trans "Solved by" %}</h4>
|
||||||
|
|
|
@ -46,12 +46,12 @@ def ctf(request, cat_slug, ctf_slug):
|
||||||
profil.last_submission_date = timezone.now()
|
profil.last_submission_date = timezone.now()
|
||||||
profil.score += ctf_info.points
|
profil.score += ctf_info.points
|
||||||
profil.save()
|
profil.save()
|
||||||
return render(request, 'ctfs/ctf_info.html', { 'ctf' : ctf_info, 'solved_list': solved_list, 'valitated': True, 'description': description})
|
return render(request, 'ctfs/ctf_info.html', { 'ctf' : ctf_info, 'solved_list': solved_list, 'valitated': True, 'description': description, 'date': timezone.now()})
|
||||||
else:
|
else:
|
||||||
return render(request, 'ctfs/ctf_info.html', { 'ctf' : ctf_info, 'solved_list': solved_list, 'failed': True, 'description': description})
|
return render(request, 'ctfs/ctf_info.html', { 'ctf' : ctf_info, 'solved_list': solved_list, 'failed': True, 'description': description, 'date': timezone.now()})
|
||||||
else:
|
else:
|
||||||
return render(request, 'ctfs/ctf_info.html', { 'ctf' : ctf_info, 'solved_list': solved_list, 'alvalitated': True, 'description': description})
|
return render(request, 'ctfs/ctf_info.html', { 'ctf' : ctf_info, 'solved_list': solved_list, 'alvalitated': True, 'description': description, 'date': timezone.now()})
|
||||||
else:
|
else:
|
||||||
return render(request, 'ctfs/ctf_info.html', { 'ctf' : ctf_info, 'solved_list': solved_list, 'description': description})
|
return render(request, 'ctfs/ctf_info.html', { 'ctf' : ctf_info, 'solved_list': solved_list, 'description': description, 'date': timezone.now()})
|
||||||
else:
|
else:
|
||||||
return render(request, 'ctfs/ctf_info.html', { 'ctf' : ctf_info, 'solved_list': solved_list, 'alvalitated': flagged, 'description': description})
|
return render(request, 'ctfs/ctf_info.html', { 'ctf' : ctf_info, 'solved_list': solved_list, 'alvalitated': flagged, 'description': description, 'date': timezone.now()})
|
||||||
|
|
|
@ -53,7 +53,7 @@
|
||||||
{% endif %}
|
{% endif %}
|
||||||
<form method="post" action="{% url 'events:submit_event_flag' event_slug=event.slug chall_slug=ctf.slug %}" class="submitflag-form">
|
<form method="post" action="{% url 'events:submit_event_flag' event_slug=event.slug chall_slug=ctf.slug %}" class="submitflag-form">
|
||||||
{% csrf_token %}
|
{% csrf_token %}
|
||||||
<input type="text" name="flag" maxlength="48" required="" id="id_flag">
|
<input type="text" name="flag" maxlength="100" required="" id="id_flag">
|
||||||
<input class="form-control" type="submit" value=">">
|
<input class="form-control" type="submit" value=">">
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
|
|
|
@ -27,7 +27,7 @@ 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)
|
||||||
if timezone.now() < ctf_info.start_date:
|
if timezone.now() < ctf_info.pub_date:
|
||||||
return redirect('events:event_info', event_slug=event_slug)
|
return redirect('events:event_info', event_slug=event_slug)
|
||||||
eventisover = False
|
eventisover = False
|
||||||
alreadyflag = False
|
alreadyflag = False
|
||||||
|
|
Loading…
Reference in New Issue