Add text to make it clearer what each user mode is (#1950)

* Closes #1935 
* Add text to make it clearer what each user mode is during setup
This commit is contained in:
Kevin Chung
2021-07-17 15:44:23 -04:00
committed by GitHub
parent 1447d14b6b
commit 327d280702
2 changed files with 68 additions and 7 deletions

View File

@@ -1,6 +1,20 @@
{% extends "base.html" %}
{% block stylesheets %}
<style>
.card-radio:checked + .card {
background-color: transparent !important;
border-color: #a3d39c;
box-shadow: 0 0 0 0.1rem #a3d39c;
transition: background-color 0.3s, border-color 0.3s;
}
.card-radio:checked + .card .card-radio-clone{
visibility: visible !important;
}
.card:hover {
cursor: pointer;
}
</style>
{% endblock %}
{% block content %}
@@ -19,6 +33,9 @@
<li class="nav-item">
<a class="nav-link active" data-toggle="pill" href="#general">General</a>
</li>
<li class="nav-item">
<a class="nav-link" data-toggle="pill" href="#mode">Mode</a>
</li>
<li class="nav-item">
<a class="nav-link" data-toggle="pill" href="#administration">Administration</a>
</li>
@@ -51,17 +68,55 @@
</small>
</div>
<div class="text-right">
<button type="button" class="btn btn-primary btn-outlined tab-next" data-href="#mode">
Next
</button>
</div>
</div>
<div class="tab-pane fade" id="mode" role="tabpanel">
<div class="form-group">
<b>{{ form.user_mode.label }}</b>
{% for radio in form.user_mode %}
<div class="form-check ml-3">
{{ radio(class="form-check-input") }}
{{ radio.label }}
</div>
{% endfor %}
<small class="form-text text-muted">
{{ form.user_mode.description }}
</small>
<div class="row pt-3">
{% for radio in form.user_mode %}
<label class="w-50 p-1">
{{ radio(class="card-radio d-none") }}
<div class="card rounded-0 h-100">
<div class="card-body p-3">
<span class="card-title">
<div class="form-check">
<input class="form-check-input card-radio-clone" type="radio" style="visibility: hidden;" checked>
<span class="form-check-label text-center">
<h5>{{ radio.label }}</h5>
</span>
{% if radio.data == "teams" %}
<ul class="p-0 small">
<li>Participants register accounts and form teams</li>
<li>If a team member solves a challenge, the entire team receives credit</li>
<br>
<li>Easier to see which team member solved a challenge</li>
<li>May be slightly more difficult to administer</li>
</ul>
{% elif radio.data == "users" %}
<ul class="p-0 small">
<li>Participants only register an individual account</li>
<li>Players can share accounts to form pseudo-teams</li>
<br>
<li>Easier to organize</li>
<li>Difficult to attribute solutions to individual team members</li>
</ul>
{% endif %}
</div>
</span>
</div>
</div>
</label>
{% endfor %}
</div>
</div>
<div class="text-right">

View File

@@ -4,6 +4,7 @@ from flask import Blueprint, abort
from flask import current_app as app
from flask import redirect, render_template, request, send_file, session, url_for
from flask.helpers import safe_join
from jinja2.exceptions import TemplateNotFound
from sqlalchemy.exc import IntegrityError
from CTFd.cache import cache
@@ -256,7 +257,12 @@ def setup():
cache.clear()
return redirect(url_for("views.static_html"))
return render_template("setup.html", state=serialize(generate_nonce()))
try:
return render_template("setup.html", state=serialize(generate_nonce()))
except TemplateNotFound:
# Set theme to default and try again
set_config("ctf_theme", DEFAULT_THEME)
return render_template("setup.html", state=serialize(generate_nonce()))
return redirect(url_for("views.static_html"))