From 03d65bf54253a77aa1916f32737607e41138b273 Mon Sep 17 00:00:00 2001 From: Kevin Chung Date: Fri, 18 Feb 2022 18:02:41 -0500 Subject: [PATCH] Have profile notify user to join/create a team (#2053) * Have profile notify user to join/create a team (Closes #2013) --- CTFd/views.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/CTFd/views.py b/CTFd/views.py index c14eb28a..6b3fae58 100644 --- a/CTFd/views.py +++ b/CTFd/views.py @@ -29,7 +29,7 @@ from CTFd.models import ( from CTFd.utils import config, get_config, set_config from CTFd.utils import user as current_user from CTFd.utils import validators -from CTFd.utils.config import is_setup +from CTFd.utils.config import is_setup, is_teams_mode from CTFd.utils.config.pages import build_markdown, get_page from CTFd.utils.config.visibility import challenges_visible from CTFd.utils.dates import ctf_ended, ctftime, view_after_ctf @@ -56,7 +56,7 @@ from CTFd.utils.security.signing import ( unserialize, ) from CTFd.utils.uploads import get_uploader, upload_file -from CTFd.utils.user import authed, get_current_user, is_admin +from CTFd.utils.user import authed, get_current_team, get_current_user, is_admin views = Blueprint("views", __name__) @@ -313,6 +313,14 @@ def settings(): affiliation = user.affiliation country = user.country + if is_teams_mode() and get_current_team() is None: + team_url = url_for("teams.private") + infos.append( + markup( + f'In order to participate you must either join or create a team.' + ) + ) + tokens = UserTokens.query.filter_by(user_id=user.id).all() prevent_name_change = get_config("prevent_name_change")