diff --git a/CHANGELOG.md b/CHANGELOG.md index 134dd85c..87eb844d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -50,6 +50,7 @@ - Create the `core-beta` theme and begin documenting the creation of themes using Vite - Add `userName` and `userEmail` to the CTFd init object in `base.html` for easier integration with other JavaScript code +- Add `teamId` and `teamName` to the CTFd init object in `base.html` for easier integration with other JavaScript code - Adds the `Assets` constant to access front end assets from Jinja templates - Adds a `views.themes_beta` route to avoid the `.dev`/`.min` extension being added automatically to frontend asset urls diff --git a/CTFd/themes/core/templates/base.html b/CTFd/themes/core/templates/base.html index 2b9ff83d..56236f2f 100644 --- a/CTFd/themes/core/templates/base.html +++ b/CTFd/themes/core/templates/base.html @@ -20,6 +20,8 @@ 'userId': {{ Session.id }}, 'userName': "{{ User.name }}", 'userEmail': "{{ User.email }}", + 'teamId': {{ Team.id | tojson }}, + 'teamName': "{{ Team.name }}", 'start': {{ Configs.start | tojson }}, 'end': {{ Configs.end | tojson }}, 'theme_settings': {{ Configs.theme_settings | tojson }} diff --git a/tests/teams/test_teams.py b/tests/teams/test_teams.py index 5ab31c35..7e8837c6 100644 --- a/tests/teams/test_teams.py +++ b/tests/teams/test_teams.py @@ -69,6 +69,10 @@ def test_hidden_teams_visibility(): r = client.get("/teams") response = r.get_data(as_text=True) + # Only search in body content + body_start = response.find("") + body_end = response.find("") + response = response[body_start:body_end] assert team_name not in response r = client.get("/api/v1/teams") @@ -79,6 +83,10 @@ def test_hidden_teams_visibility(): r = client.get("/scoreboard") response = r.get_data(as_text=True) + # Only search in body content + body_start = response.find("") + body_end = response.find("") + response = response[body_start:body_end] assert team_name not in response r = client.get("/api/v1/scoreboard")