mirror of
https://github.com/aljazceru/CTFd.git
synced 2025-12-17 22:14:25 +01:00
@@ -1,6 +1,5 @@
|
|||||||
function teamid (){
|
function teamid (){
|
||||||
loc = window.location.pathname
|
return $('#team-id').attr('team-id');
|
||||||
return loc.substring(loc.lastIndexOf('/')+1, loc.length);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function colorhash (x) {
|
function colorhash (x) {
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
{% block content %}
|
{% block content %}
|
||||||
<div class="jumbotron home">
|
<div class="jumbotron home">
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<h1 id="team-id">{{ team.name }}</h1>
|
<h1 id="team-id" team-id="{{ team.id }}">{{ team.name }}</h1>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="container main-container">
|
<div class="container main-container">
|
||||||
|
|||||||
@@ -135,6 +135,33 @@ def teams(page):
|
|||||||
return render_template('teams.html', teams=teams, team_pages=pages, curr_page=page)
|
return render_template('teams.html', teams=teams, team_pages=pages, curr_page=page)
|
||||||
|
|
||||||
|
|
||||||
|
@views.route('/team', methods=['GET'])
|
||||||
|
def private_team():
|
||||||
|
if utils.authed():
|
||||||
|
teamid = session['id']
|
||||||
|
|
||||||
|
freeze = utils.get_config('freeze')
|
||||||
|
user = Teams.query.filter_by(id=teamid).first_or_404()
|
||||||
|
solves = Solves.query.filter_by(teamid=teamid)
|
||||||
|
awards = Awards.query.filter_by(teamid=teamid)
|
||||||
|
|
||||||
|
place = user.place()
|
||||||
|
score = user.score()
|
||||||
|
|
||||||
|
if freeze:
|
||||||
|
freeze = utils.unix_time_to_utc(freeze)
|
||||||
|
if teamid != session.get('id'):
|
||||||
|
solves = solves.filter(Solves.date < freeze)
|
||||||
|
awards = awards.filter(Awards.date < freeze)
|
||||||
|
|
||||||
|
solves = solves.all()
|
||||||
|
awards = awards.all()
|
||||||
|
|
||||||
|
return render_template('team.html', solves=solves, awards=awards, team=user, score=score, place=place, score_frozen=utils.is_scoreboard_frozen())
|
||||||
|
else:
|
||||||
|
return redirect(url_for('auth.login'))
|
||||||
|
|
||||||
|
|
||||||
@views.route('/team/<int:teamid>', methods=['GET', 'POST'])
|
@views.route('/team/<int:teamid>', methods=['GET', 'POST'])
|
||||||
def team(teamid):
|
def team(teamid):
|
||||||
if utils.get_config('view_scoreboard_if_utils.authed') and not utils.authed():
|
if utils.get_config('view_scoreboard_if_utils.authed') and not utils.authed():
|
||||||
|
|||||||
@@ -174,6 +174,17 @@ def test_user_get_team_page():
|
|||||||
destroy_ctfd(app)
|
destroy_ctfd(app)
|
||||||
|
|
||||||
|
|
||||||
|
def test_user_get_private_team_page():
|
||||||
|
"""Can a registered user load their private team page (/team)"""
|
||||||
|
app = create_ctfd()
|
||||||
|
with app.app_context():
|
||||||
|
register_user(app)
|
||||||
|
client = login_as_user(app)
|
||||||
|
r = client.get('/team')
|
||||||
|
assert r.status_code == 200
|
||||||
|
destroy_ctfd(app)
|
||||||
|
|
||||||
|
|
||||||
def test_user_get_profile():
|
def test_user_get_profile():
|
||||||
"""Can a registered user load their private profile (/profile)"""
|
"""Can a registered user load their private profile (/profile)"""
|
||||||
app = create_ctfd()
|
app = create_ctfd()
|
||||||
|
|||||||
Reference in New Issue
Block a user