We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
Review usage of error components
Looks like there needs to be more usage of the error components jinja snippet. It looks like it's missing in core/teams/public and core/teams/private at least. 

--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `CTFd/teams.py`
Content:
```
1 from flask import Blueprint, redirect, render_template, request, url_for
2 
3 from CTFd.cache import clear_team_session, clear_user_session
4 from CTFd.models import Teams, db
5 from CTFd.utils import config, get_config
6 from CTFd.utils.crypto import verify_password
7 from CTFd.utils.decorators import authed_only, ratelimit
8 from CTFd.utils.decorators.modes import require_team_mode
9 from CTFd.utils.decorators.visibility import (
10     check_account_visibility,
11     check_score_visibility,
12 )
13 from CTFd.utils.helpers import get_errors, get_infos
14 from CTFd.utils.user import get_current_user
15 
16 teams = Blueprint("teams", __name__)
17 
18 
19 @teams.route("/teams")
20 @check_account_visibility
21 @require_team_mode
22 def listing():
23     q = request.args.get("q")
24     field = request.args.get("field", "name")
25     filters = []
26 
27     if field not in ("name", "affiliation", "website"):
28         field = "name"
29 
30     if q:
31         filters.append(getattr(Teams, field).like("%{}%".format(q)))
32 
33     teams = (
34         Teams.query.filter_by(hidden=False, banned=False)
35         .filter(*filters)
36         .order_by(Teams.id.asc())
37         .paginate(per_page=50)
38     )
39 
40     args = dict(request.args)
41     args.pop("page", 1)
42 
43     return render_template(
44         "teams/teams.html",
45         teams=teams,
46         prev_page=url_for(request.endpoint, page=teams.prev_num, **args),
47         next_page=url_for(request.endpoint, page=teams.next_num, **args),
48         q=q,
49         field=field,
50     )
51 
52 
53 @teams.route("/teams/join", methods=["GET", "POST"])
54 @authed_only
55 @require_team_mode
56 @ratelimit(method="POST", limit=10, interval=5)
57 def join():
58     infos = get_infos()
59     errors = get_errors()
60     if request.method == "GET":
61         team_size_limit = get_config("team_size", default=0)
62         if team_size_limit:
63             plural = "" if team_size_limit == 1 else "s"
64             infos.append(
65                 "Teams are limited to {limit} member{plural}".format(
66                     limit=team_size_limit, plural=plural
67                 )
68             )
69         return render_template("teams/join_team.html", infos=infos, errors=errors)
70 
71     if request.method == "POST":
72         teamname = request.form.get("name")
73         passphrase = request.form.get("password", "").strip()
74 
75         team = Teams.query.filter_by(name=teamname).first()
76 
77         if team and verify_password(passphrase, team.password):
78             team_size_limit = get_config("team_size", default=0)
79             if team_size_limit and len(team.members) >= team_size_limit:
80                 errors.append(
81                     "{name} has already reached the team size limit of {limit}".format(
82                         name=team.name, limit=team_size_limit
83                     )
84                 )
85                 return render_template(
86                     "teams/join_team.html", infos=infos, errors=errors
87                 )
88 
89             user = get_current_user()
90             user.team_id = team.id
91             db.session.commit()
92 
93             if len(team.members) == 1:
94                 team.captain_id = user.id
95                 db.session.commit()
96 
97             clear_user_session(user_id=user.id)
98             clear_team_session(team_id=team.id)
99 
100             return redirect(url_for("challenges.listing"))
101         else:
102             errors.append("That information is incorrect")
103             return render_template("teams/join_team.html", infos=infos, errors=errors)
104 
105 
106 @teams.route("/teams/new", methods=["GET", "POST"])
107 @authed_only
108 @require_team_mode
109 def new():
110     infos = get_infos()
111     errors = get_errors()
112     if request.method == "GET":
113         team_size_limit = get_config("team_size", default=0)
114         if team_size_limit:
115             plural = "" if team_size_limit == 1 else "s"
116             infos.append(
117                 "Teams are limited to {limit} member{plural}".format(
118                     limit=team_size_limit, plural=plural
119                 )
120             )
121 
122         return render_template("teams/new_team.html", infos=infos, errors=errors)
123     elif request.method == "POST":
124         teamname = request.form.get("name", "").strip()
125         passphrase = request.form.get("password", "").strip()
126         errors = get_errors()
127 
128         user = get_current_user()
129 
130         existing_team = Teams.query.filter_by(name=teamname).first()
131         if existing_team:
132             errors.append("That team name is already taken")
133         if not teamname:
134             errors.append("That team name is invalid")
135 
136         if errors:
137             return render_template("teams/new_team.html", errors=errors)
138 
139         team = Teams(name=teamname, password=passphrase, captain_id=user.id)
140 
141         db.session.add(team)
142         db.session.commit()
143 
144         user.team_id = team.id
145         db.session.commit()
146 
147         clear_user_session(user_id=user.id)
148         clear_team_session(team_id=team.id)
149 
150         return redirect(url_for("challenges.listing"))
151 
152 
153 @teams.route("/team")
154 @authed_only
155 @require_team_mode
156 def private():
157     user = get_current_user()
158     if not user.team_id:
159         return render_template("teams/team_enrollment.html")
160 
161     team_id = user.team_id
162 
163     team = Teams.query.filter_by(id=team_id).first_or_404()
164     solves = team.get_solves()
165     awards = team.get_awards()
166 
167     place = team.place
168     score = team.score
169 
170     return render_template(
171         "teams/private.html",
172         solves=solves,
173         awards=awards,
174         user=user,
175         team=team,
176         score=score,
177         place=place,
178         score_frozen=config.is_scoreboard_frozen(),
179     )
180 
181 
182 @teams.route("/teams/<int:team_id>")
183 @check_account_visibility
184 @check_score_visibility
185 @require_team_mode
186 def public(team_id):
187     errors = get_errors()
188     team = Teams.query.filter_by(id=team_id, banned=False, hidden=False).first_or_404()
189     solves = team.get_solves()
190     awards = team.get_awards()
191 
192     place = team.place
193     score = team.score
194 
195     if errors:
196         return render_template("teams/public.html", team=team, errors=errors)
197 
198     return render_template(
199         "teams/public.html",
200         solves=solves,
201         awards=awards,
202         team=team,
203         score=score,
204         place=place,
205         score_frozen=config.is_scoreboard_frozen(),
206     )
207
```
--- END FILES ---

Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.

Here is an example:

```diff
diff --git a/examples/server_async.py b/examples/server_async.py
--- a/examples/server_async.py
+++ b/examples/server_async.py
@@ -313,4 +313,4 @@
 
 
 if __name__ == "__main__":
-    asyncio.run(run_async_server("."), debug=True)
+    asyncio.run(run_async_server(), debug=True)
diff --git a/examples/server_sync.py b/examples/server_sync.py
--- a/examples/server_sync.py
+++ b/examples/server_sync.py
@@ -313,5 +313,5 @@
 
 
 if __name__ == "__main__":
-    server = run_sync_server(".")
+    server = run_sync_server()
     server.shutdown()

```

diff --git a/CTFd/teams.py b/CTFd/teams.py
--- a/CTFd/teams.py
+++ b/CTFd/teams.py
@@ -154,6 +154,9 @@
 @authed_only
 @require_team_mode
 def private():
+    infos = get_infos()
+    errors = get_errors()
+
     user = get_current_user()
     if not user.team_id:
         return render_template("teams/team_enrollment.html")
@@ -167,6 +170,9 @@
     place = team.place
     score = team.score
 
+    if config.is_scoreboard_frozen():
+        infos.append("Scoreboard has been frozen")
+
     return render_template(
         "teams/private.html",
         solves=solves,
@@ -176,6 +182,8 @@
         score=score,
         place=place,
         score_frozen=config.is_scoreboard_frozen(),
+        infos=infos,
+        errors=errors,
     )
 
 
@@ -184,6 +192,7 @@
 @check_score_visibility
 @require_team_mode
 def public(team_id):
+    infos = get_infos()
     errors = get_errors()
     team = Teams.query.filter_by(id=team_id, banned=False, hidden=False).first_or_404()
     solves = team.get_solves()
@@ -195,6 +204,9 @@
     if errors:
         return render_template("teams/public.html", team=team, errors=errors)
 
+    if config.is_scoreboard_frozen():
+        infos.append("Scoreboard has been frozen")
+
     return render_template(
         "teams/public.html",
         solves=solves,
@@ -203,4 +215,6 @@
         score=score,
         place=place,
         score_frozen=config.is_scoreboard_frozen(),
+        infos=infos,
+        errors=errors,
     )

{"golden_diff": "diff --git a/CTFd/teams.py b/CTFd/teams.py\n--- a/CTFd/teams.py\n+++ b/CTFd/teams.py\n@@ -154,6 +154,9 @@\n @authed_only\n @require_team_mode\n def private():\n+    infos = get_infos()\n+    errors = get_errors()\n+\n     user = get_current_user()\n     if not user.team_id:\n         return render_template(\"teams/team_enrollment.html\")\n@@ -167,6 +170,9 @@\n     place = team.place\n     score = team.score\n \n+    if config.is_scoreboard_frozen():\n+        infos.append(\"Scoreboard has been frozen\")\n+\n     return render_template(\n         \"teams/private.html\",\n         solves=solves,\n@@ -176,6 +182,8 @@\n         score=score,\n         place=place,\n         score_frozen=config.is_scoreboard_frozen(),\n+        infos=infos,\n+        errors=errors,\n     )\n \n \n@@ -184,6 +192,7 @@\n @check_score_visibility\n @require_team_mode\n def public(team_id):\n+    infos = get_infos()\n     errors = get_errors()\n     team = Teams.query.filter_by(id=team_id, banned=False, hidden=False).first_or_404()\n     solves = team.get_solves()\n@@ -195,6 +204,9 @@\n     if errors:\n         return render_template(\"teams/public.html\", team=team, errors=errors)\n \n+    if config.is_scoreboard_frozen():\n+        infos.append(\"Scoreboard has been frozen\")\n+\n     return render_template(\n         \"teams/public.html\",\n         solves=solves,\n@@ -203,4 +215,6 @@\n         score=score,\n         place=place,\n         score_frozen=config.is_scoreboard_frozen(),\n+        infos=infos,\n+        errors=errors,\n     )\n", "issue": "Review usage of error components\nLooks like there needs to be more usage of the error components jinja snippet. It looks like it's missing in core/teams/public and core/teams/private at least. \n", "before_files": [{"content": "from flask import Blueprint, redirect, render_template, request, url_for\n\nfrom CTFd.cache import clear_team_session, clear_user_session\nfrom CTFd.models import Teams, db\nfrom CTFd.utils import config, get_config\nfrom CTFd.utils.crypto import verify_password\nfrom CTFd.utils.decorators import authed_only, ratelimit\nfrom CTFd.utils.decorators.modes import require_team_mode\nfrom CTFd.utils.decorators.visibility import (\n    check_account_visibility,\n    check_score_visibility,\n)\nfrom CTFd.utils.helpers import get_errors, get_infos\nfrom CTFd.utils.user import get_current_user\n\nteams = Blueprint(\"teams\", __name__)\n\n\n@teams.route(\"/teams\")\n@check_account_visibility\n@require_team_mode\ndef listing():\n    q = request.args.get(\"q\")\n    field = request.args.get(\"field\", \"name\")\n    filters = []\n\n    if field not in (\"name\", \"affiliation\", \"website\"):\n        field = \"name\"\n\n    if q:\n        filters.append(getattr(Teams, field).like(\"%{}%\".format(q)))\n\n    teams = (\n        Teams.query.filter_by(hidden=False, banned=False)\n        .filter(*filters)\n        .order_by(Teams.id.asc())\n        .paginate(per_page=50)\n    )\n\n    args = dict(request.args)\n    args.pop(\"page\", 1)\n\n    return render_template(\n        \"teams/teams.html\",\n        teams=teams,\n        prev_page=url_for(request.endpoint, page=teams.prev_num, **args),\n        next_page=url_for(request.endpoint, page=teams.next_num, **args),\n        q=q,\n        field=field,\n    )\n\n\n@teams.route(\"/teams/join\", methods=[\"GET\", \"POST\"])\n@authed_only\n@require_team_mode\n@ratelimit(method=\"POST\", limit=10, interval=5)\ndef join():\n    infos = get_infos()\n    errors = get_errors()\n    if request.method == \"GET\":\n        team_size_limit = get_config(\"team_size\", default=0)\n        if team_size_limit:\n            plural = \"\" if team_size_limit == 1 else \"s\"\n            infos.append(\n                \"Teams are limited to {limit} member{plural}\".format(\n                    limit=team_size_limit, plural=plural\n                )\n            )\n        return render_template(\"teams/join_team.html\", infos=infos, errors=errors)\n\n    if request.method == \"POST\":\n        teamname = request.form.get(\"name\")\n        passphrase = request.form.get(\"password\", \"\").strip()\n\n        team = Teams.query.filter_by(name=teamname).first()\n\n        if team and verify_password(passphrase, team.password):\n            team_size_limit = get_config(\"team_size\", default=0)\n            if team_size_limit and len(team.members) >= team_size_limit:\n                errors.append(\n                    \"{name} has already reached the team size limit of {limit}\".format(\n                        name=team.name, limit=team_size_limit\n                    )\n                )\n                return render_template(\n                    \"teams/join_team.html\", infos=infos, errors=errors\n                )\n\n            user = get_current_user()\n            user.team_id = team.id\n            db.session.commit()\n\n            if len(team.members) == 1:\n                team.captain_id = user.id\n                db.session.commit()\n\n            clear_user_session(user_id=user.id)\n            clear_team_session(team_id=team.id)\n\n            return redirect(url_for(\"challenges.listing\"))\n        else:\n            errors.append(\"That information is incorrect\")\n            return render_template(\"teams/join_team.html\", infos=infos, errors=errors)\n\n\n@teams.route(\"/teams/new\", methods=[\"GET\", \"POST\"])\n@authed_only\n@require_team_mode\ndef new():\n    infos = get_infos()\n    errors = get_errors()\n    if request.method == \"GET\":\n        team_size_limit = get_config(\"team_size\", default=0)\n        if team_size_limit:\n            plural = \"\" if team_size_limit == 1 else \"s\"\n            infos.append(\n                \"Teams are limited to {limit} member{plural}\".format(\n                    limit=team_size_limit, plural=plural\n                )\n            )\n\n        return render_template(\"teams/new_team.html\", infos=infos, errors=errors)\n    elif request.method == \"POST\":\n        teamname = request.form.get(\"name\", \"\").strip()\n        passphrase = request.form.get(\"password\", \"\").strip()\n        errors = get_errors()\n\n        user = get_current_user()\n\n        existing_team = Teams.query.filter_by(name=teamname).first()\n        if existing_team:\n            errors.append(\"That team name is already taken\")\n        if not teamname:\n            errors.append(\"That team name is invalid\")\n\n        if errors:\n            return render_template(\"teams/new_team.html\", errors=errors)\n\n        team = Teams(name=teamname, password=passphrase, captain_id=user.id)\n\n        db.session.add(team)\n        db.session.commit()\n\n        user.team_id = team.id\n        db.session.commit()\n\n        clear_user_session(user_id=user.id)\n        clear_team_session(team_id=team.id)\n\n        return redirect(url_for(\"challenges.listing\"))\n\n\n@teams.route(\"/team\")\n@authed_only\n@require_team_mode\ndef private():\n    user = get_current_user()\n    if not user.team_id:\n        return render_template(\"teams/team_enrollment.html\")\n\n    team_id = user.team_id\n\n    team = Teams.query.filter_by(id=team_id).first_or_404()\n    solves = team.get_solves()\n    awards = team.get_awards()\n\n    place = team.place\n    score = team.score\n\n    return render_template(\n        \"teams/private.html\",\n        solves=solves,\n        awards=awards,\n        user=user,\n        team=team,\n        score=score,\n        place=place,\n        score_frozen=config.is_scoreboard_frozen(),\n    )\n\n\n@teams.route(\"/teams/<int:team_id>\")\n@check_account_visibility\n@check_score_visibility\n@require_team_mode\ndef public(team_id):\n    errors = get_errors()\n    team = Teams.query.filter_by(id=team_id, banned=False, hidden=False).first_or_404()\n    solves = team.get_solves()\n    awards = team.get_awards()\n\n    place = team.place\n    score = team.score\n\n    if errors:\n        return render_template(\"teams/public.html\", team=team, errors=errors)\n\n    return render_template(\n        \"teams/public.html\",\n        solves=solves,\n        awards=awards,\n        team=team,\n        score=score,\n        place=place,\n        score_frozen=config.is_scoreboard_frozen(),\n    )\n", "path": "CTFd/teams.py"}], "after_files": [{"content": "from flask import Blueprint, redirect, render_template, request, url_for\n\nfrom CTFd.cache import clear_team_session, clear_user_session\nfrom CTFd.models import Teams, db\nfrom CTFd.utils import config, get_config\nfrom CTFd.utils.crypto import verify_password\nfrom CTFd.utils.decorators import authed_only, ratelimit\nfrom CTFd.utils.decorators.modes import require_team_mode\nfrom CTFd.utils.decorators.visibility import (\n    check_account_visibility,\n    check_score_visibility,\n)\nfrom CTFd.utils.helpers import get_errors, get_infos\nfrom CTFd.utils.user import get_current_user\n\nteams = Blueprint(\"teams\", __name__)\n\n\n@teams.route(\"/teams\")\n@check_account_visibility\n@require_team_mode\ndef listing():\n    q = request.args.get(\"q\")\n    field = request.args.get(\"field\", \"name\")\n    filters = []\n\n    if field not in (\"name\", \"affiliation\", \"website\"):\n        field = \"name\"\n\n    if q:\n        filters.append(getattr(Teams, field).like(\"%{}%\".format(q)))\n\n    teams = (\n        Teams.query.filter_by(hidden=False, banned=False)\n        .filter(*filters)\n        .order_by(Teams.id.asc())\n        .paginate(per_page=50)\n    )\n\n    args = dict(request.args)\n    args.pop(\"page\", 1)\n\n    return render_template(\n        \"teams/teams.html\",\n        teams=teams,\n        prev_page=url_for(request.endpoint, page=teams.prev_num, **args),\n        next_page=url_for(request.endpoint, page=teams.next_num, **args),\n        q=q,\n        field=field,\n    )\n\n\n@teams.route(\"/teams/join\", methods=[\"GET\", \"POST\"])\n@authed_only\n@require_team_mode\n@ratelimit(method=\"POST\", limit=10, interval=5)\ndef join():\n    infos = get_infos()\n    errors = get_errors()\n    if request.method == \"GET\":\n        team_size_limit = get_config(\"team_size\", default=0)\n        if team_size_limit:\n            plural = \"\" if team_size_limit == 1 else \"s\"\n            infos.append(\n                \"Teams are limited to {limit} member{plural}\".format(\n                    limit=team_size_limit, plural=plural\n                )\n            )\n        return render_template(\"teams/join_team.html\", infos=infos, errors=errors)\n\n    if request.method == \"POST\":\n        teamname = request.form.get(\"name\")\n        passphrase = request.form.get(\"password\", \"\").strip()\n\n        team = Teams.query.filter_by(name=teamname).first()\n\n        if team and verify_password(passphrase, team.password):\n            team_size_limit = get_config(\"team_size\", default=0)\n            if team_size_limit and len(team.members) >= team_size_limit:\n                errors.append(\n                    \"{name} has already reached the team size limit of {limit}\".format(\n                        name=team.name, limit=team_size_limit\n                    )\n                )\n                return render_template(\n                    \"teams/join_team.html\", infos=infos, errors=errors\n                )\n\n            user = get_current_user()\n            user.team_id = team.id\n            db.session.commit()\n\n            if len(team.members) == 1:\n                team.captain_id = user.id\n                db.session.commit()\n\n            clear_user_session(user_id=user.id)\n            clear_team_session(team_id=team.id)\n\n            return redirect(url_for(\"challenges.listing\"))\n        else:\n            errors.append(\"That information is incorrect\")\n            return render_template(\"teams/join_team.html\", infos=infos, errors=errors)\n\n\n@teams.route(\"/teams/new\", methods=[\"GET\", \"POST\"])\n@authed_only\n@require_team_mode\ndef new():\n    infos = get_infos()\n    errors = get_errors()\n    if request.method == \"GET\":\n        team_size_limit = get_config(\"team_size\", default=0)\n        if team_size_limit:\n            plural = \"\" if team_size_limit == 1 else \"s\"\n            infos.append(\n                \"Teams are limited to {limit} member{plural}\".format(\n                    limit=team_size_limit, plural=plural\n                )\n            )\n\n        return render_template(\"teams/new_team.html\", infos=infos, errors=errors)\n    elif request.method == \"POST\":\n        teamname = request.form.get(\"name\", \"\").strip()\n        passphrase = request.form.get(\"password\", \"\").strip()\n        errors = get_errors()\n\n        user = get_current_user()\n\n        existing_team = Teams.query.filter_by(name=teamname).first()\n        if existing_team:\n            errors.append(\"That team name is already taken\")\n        if not teamname:\n            errors.append(\"That team name is invalid\")\n\n        if errors:\n            return render_template(\"teams/new_team.html\", errors=errors)\n\n        team = Teams(name=teamname, password=passphrase, captain_id=user.id)\n\n        db.session.add(team)\n        db.session.commit()\n\n        user.team_id = team.id\n        db.session.commit()\n\n        clear_user_session(user_id=user.id)\n        clear_team_session(team_id=team.id)\n\n        return redirect(url_for(\"challenges.listing\"))\n\n\n@teams.route(\"/team\")\n@authed_only\n@require_team_mode\ndef private():\n    infos = get_infos()\n    errors = get_errors()\n\n    user = get_current_user()\n    if not user.team_id:\n        return render_template(\"teams/team_enrollment.html\")\n\n    team_id = user.team_id\n\n    team = Teams.query.filter_by(id=team_id).first_or_404()\n    solves = team.get_solves()\n    awards = team.get_awards()\n\n    place = team.place\n    score = team.score\n\n    if config.is_scoreboard_frozen():\n        infos.append(\"Scoreboard has been frozen\")\n\n    return render_template(\n        \"teams/private.html\",\n        solves=solves,\n        awards=awards,\n        user=user,\n        team=team,\n        score=score,\n        place=place,\n        score_frozen=config.is_scoreboard_frozen(),\n        infos=infos,\n        errors=errors,\n    )\n\n\n@teams.route(\"/teams/<int:team_id>\")\n@check_account_visibility\n@check_score_visibility\n@require_team_mode\ndef public(team_id):\n    infos = get_infos()\n    errors = get_errors()\n    team = Teams.query.filter_by(id=team_id, banned=False, hidden=False).first_or_404()\n    solves = team.get_solves()\n    awards = team.get_awards()\n\n    place = team.place\n    score = team.score\n\n    if errors:\n        return render_template(\"teams/public.html\", team=team, errors=errors)\n\n    if config.is_scoreboard_frozen():\n        infos.append(\"Scoreboard has been frozen\")\n\n    return render_template(\n        \"teams/public.html\",\n        solves=solves,\n        awards=awards,\n        team=team,\n        score=score,\n        place=place,\n        score_frozen=config.is_scoreboard_frozen(),\n        infos=infos,\n        errors=errors,\n    )\n", "path": "CTFd/teams.py"}]}