Have profile notify user to join/create a team (#2053)

* Have profile notify user to join/create a team (Closes #2013)
This commit is contained in:
Kevin Chung
2022-02-18 18:02:41 -05:00
committed by GitHub
parent 52d41bac61
commit 03d65bf542

View File

@@ -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 <a href="{team_url}">join or create a team</a>.'
)
)
tokens = UserTokens.query.filter_by(user_id=user.id).all()
prevent_name_change = get_config("prevent_name_change")