mirror of
https://github.com/aljazceru/CTFd.git
synced 2026-01-06 07:34:21 +01:00
Hide scores (#224)
* Starting work on hide_scores functionality * Hide teams in more views * Starting work on hide_scores functionality * Hide teams in more views
This commit is contained in:
@@ -6,7 +6,7 @@ from jinja2.exceptions import TemplateNotFound
|
||||
from passlib.hash import bcrypt_sha256
|
||||
|
||||
from CTFd.utils import authed, is_setup, validate_url, get_config, set_config, sha512, cache, ctftime, view_after_ctf, ctf_started, \
|
||||
is_admin
|
||||
is_admin, hide_scores
|
||||
from CTFd.models import db, Teams, Solves, Awards, Files, Pages
|
||||
|
||||
views = Blueprint('views', __name__)
|
||||
@@ -131,6 +131,7 @@ def teams(page):
|
||||
def team(teamid):
|
||||
if get_config('view_scoreboard_if_authed') and not authed():
|
||||
return redirect(url_for('auth.login', next=request.path))
|
||||
errors = []
|
||||
user = Teams.query.filter_by(id=teamid).first_or_404()
|
||||
solves = Solves.query.filter_by(teamid=teamid)
|
||||
awards = Awards.query.filter_by(teamid=teamid).all()
|
||||
@@ -138,6 +139,12 @@ def team(teamid):
|
||||
place = user.place()
|
||||
db.session.close()
|
||||
|
||||
if hide_scores() and teamid != session.get('id'):
|
||||
errors.append('Scores are currently hidden')
|
||||
|
||||
if errors:
|
||||
return render_template('team.html', team=user, errors=errors)
|
||||
|
||||
if request.method == 'GET':
|
||||
return render_template('team.html', solves=solves, awards=awards, team=user, score=score, place=place)
|
||||
elif request.method == 'POST':
|
||||
|
||||
Reference in New Issue
Block a user