Merge branch 'master' of github.com:IceCTF/new-platform

master
Glitch 2016-07-12 23:04:29 +00:00
commit f1f54ccd53
3 changed files with 71 additions and 62 deletions

17
ctftool
View File

@ -12,6 +12,7 @@ import redis
import random import random
import utils import utils
import utils.admin import utils.admin
import utils.misc
import yaml import yaml
import argparse import argparse
import logging import logging
@ -41,11 +42,21 @@ def gen_team(args):
ctz = datetime.now() ctz = datetime.now()
diff = timedelta(minutes=5) diff = timedelta(minutes=5)
for i in range(n): for i in range(n):
name = "Team {}".format(i + 1) name = "Team {} {}".format(i + 1, utils.misc.generate_random_string(length=5))
t = Team.create(name=name, email="none@none.com", affiliation="Autogenerated", eligible=True, key="", email_confirmation_key="autogen", email_confirmed=True) team_key = utils.misc.generate_team_key()
t.key = "autogen{}".format(t.id) t = Team.create(name=name, affiliation="Autogenerated", key=team_key)
username = "username{}".format(i+1)
user = User.create(username=username, email="nope@nope.nope",
background="university", country="ISL",
tshirt_size="XL", gender="M",
email_confirmation_key="autogen", email_confirmed=True,
team=t)
t.save() t.save()
password = "password{}".format(user.id)
user.setPassword()
user.save()
print("Team added with id {}".format(t.id)) print("Team added with id {}".format(t.id))
print("User added with username {} and password {}".format(username, password))
def add_admin(args): def add_admin(args):
username = input("Username: ") username = input("Username: ")

View File

@ -45,64 +45,64 @@
</ul> </ul>
</div> </div>
<ul id="nav-mobile" class="side-nav fixed">
{% if config.competition_is_running() %}
{% if logged_in %}
<li><a href="{{ url_for('challenges') }}">
<div class="side-icon"><i class="material-icons blue-text">flag</i></div>
<div class="side-text">Challenges</div>
</a></li>
{% endif %}
<li><a href="{{ url_for('scoreboard') }}">
<div class="side-icon"><i class="material-icons red-text">timeline</i></div>
<div class="side-text">Scoreboard</div>
</a></li>
<li><a href="{{ url_for('chat') }}">
<div class="side-icon"><i class="material-icons green-text">chat</i></div>
<div class="side-text">Chat</div>
</a></li>
{% endif %}
{% if logged_in %}
<li><a href="{{ url_for('team_tickets') }}">
<div class="side-icon"><i class="material-icons amber-text">report_problem</i></div>
<div class="side-text">Tickets</div>
</a></li>
{% endif %}
<li><a href="{{ url_for('chat') }}">
<div class="side-icon"><i class="material-icons purple-text">build</i></div>
<div class="side-text">Status</div>
</a></li>
<div class="divider" /></div>
{% if logged_in %}
<li><a href="{{ url_for('team_dashboard') }}">
<div class="side-icon"><i class="material-icons indigo-text">track_changes</i></div>
<div class="side-text">My Team</div>
</a></li>
<li><a href="{{ url_for('user_dashboard') }}">
<div class="side-icon"><i class="material-icons teal-text">account_circle</i></div>
<div class="side-text">{{ user.username }}</div>
</a></li>
<li><a href="{{ url_for('logout') }}">
<div class="side-icon"><i class="material-icons red-text">block</i></div>
<div class="side-text">Logout</div>
</a></li>
{% endif %}
{% if not logged_in %}
{% if config.registration %}
<li><a href="{{ url_for('register') }}">
<div class="side-icon"><i class="material-icons indigo-text">person_add</i></div>
<div class="side-text">Register</div>
</a></li>
{% endif %}
<li><a href="{{ url_for('login') }}">
<div class="side-icon"><i class="material-icons amber-text">lock</i></div>
<div class="side-text">Login</div>
</a></li>
{% endif %}
</ul>
</nav> </nav>
<ul id="nav-mobile" class="side-nav fixed">
{% if config.competition_is_running() %}
{% if logged_in %}
<li><a href="{{ url_for('challenges') }}">
<div class="side-icon"><i class="material-icons blue-text">flag</i></div>
<div class="side-text">Challenges</div>
</a></li>
{% endif %}
<li><a href="{{ url_for('scoreboard') }}">
<div class="side-icon"><i class="material-icons red-text">timeline</i></div>
<div class="side-text">Scoreboard</div>
</a></li>
<li><a href="{{ url_for('chat') }}">
<div class="side-icon"><i class="material-icons green-text">chat</i></div>
<div class="side-text">Chat</div>
</a></li>
{% endif %}
{% if logged_in %}
<li><a href="{{ url_for('team_tickets') }}">
<div class="side-icon"><i class="material-icons amber-text">report_problem</i></div>
<div class="side-text">Tickets</div>
</a></li>
{% endif %}
<li><a href="{{ url_for('chat') }}">
<div class="side-icon"><i class="material-icons purple-text">build</i></div>
<div class="side-text">Status</div>
</a></li>
<div class="divider" /></div>
{% if logged_in %}
<li><a href="{{ url_for('team_dashboard') }}">
<div class="side-icon"><i class="material-icons indigo-text">track_changes</i></div>
<div class="side-text">My Team</div>
</a></li>
<li><a href="{{ url_for('user_dashboard') }}">
<div class="side-icon"><i class="material-icons teal-text">account_circle</i></div>
<div class="side-text">{{ user.username }}</div>
</a></li>
<li><a href="{{ url_for('logout') }}">
<div class="side-icon"><i class="material-icons red-text">block</i></div>
<div class="side-text">Logout</div>
</a></li>
{% endif %}
{% if not logged_in %}
{% if config.registration %}
<li><a href="{{ url_for('register') }}">
<div class="side-icon"><i class="material-icons indigo-text">person_add</i></div>
<div class="side-text">Register</div>
</a></li>
{% endif %}
<li><a href="{{ url_for('login') }}">
<div class="side-icon"><i class="material-icons amber-text">lock</i></div>
<div class="side-text">Login</div>
</a></li>
{% endif %}
</ul>
</header> </header>
<div class="cont"> <div class="cont">
{% if session.admin %} {% if session.admin %}

View File

@ -28,8 +28,6 @@
</script> </script>
{% endblock %} {% endblock %}
{% block content %} {% block content %}
<p>You are playing on behalf of {{ team.name }}. If this is incorrect, you should
<a href="{{ url_for('logout') }}">logout</a> and login with the correct team key.</p>
<select onchange="filterCategories(this);"> <select onchange="filterCategories(this);">
<option value="*">Show all</option> <option value="*">Show all</option>