mirror of
https://github.com/aljazceru/CTFd.git
synced 2025-12-17 14:04:20 +01:00
Simple bugfix merges (#1531)
* Closes #1530 * Clean up some wording and comments * Pin isort version to fix flake8 issue (https://github.com/gforcada/flake8-isort/issues/88)
This commit is contained in:
@@ -374,6 +374,7 @@ class Challenge(Resource):
|
|||||||
response["solves"] = solves
|
response["solves"] = solves
|
||||||
else:
|
else:
|
||||||
response["solves"] = None
|
response["solves"] = None
|
||||||
|
solves = None
|
||||||
|
|
||||||
if authed():
|
if authed():
|
||||||
# Get current attempts for the user
|
# Get current attempts for the user
|
||||||
|
|||||||
@@ -399,7 +399,7 @@ $(() => {
|
|||||||
ezQuery({
|
ezQuery({
|
||||||
title: "Missing Flags",
|
title: "Missing Flags",
|
||||||
body:
|
body:
|
||||||
"This challenge does not have any flags meaning it is unsolveable. Are you sure you'd like to update this challenge?",
|
"This challenge does not have any flags meaning it may be unsolveable. Are you sure you'd like to update this challenge?",
|
||||||
success: update_challenge
|
success: update_challenge
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -52,6 +52,13 @@ const displayChal = chal => {
|
|||||||
|
|
||||||
$("#challenge-window").empty();
|
$("#challenge-window").empty();
|
||||||
|
|
||||||
|
// Inject challenge data into the plugin
|
||||||
|
challenge.data = responses[0].data;
|
||||||
|
|
||||||
|
// Call preRender function in plugin
|
||||||
|
challenge.preRender();
|
||||||
|
|
||||||
|
// Build HTML from the Jinja response in API
|
||||||
$("#challenge-window").append(responses[0].data.view);
|
$("#challenge-window").append(responses[0].data.view);
|
||||||
|
|
||||||
$("#challenge-window #challenge-input").addClass("form-control");
|
$("#challenge-window #challenge-input").addClass("form-control");
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
4
Makefile
4
Makefile
@@ -12,7 +12,9 @@ format:
|
|||||||
prettier --write '**/*.md'
|
prettier --write '**/*.md'
|
||||||
|
|
||||||
test:
|
test:
|
||||||
pytest -rf --cov=CTFd --cov-context=test --ignore=node_modules/ \
|
pytest -rf --cov=CTFd --cov-context=test \
|
||||||
|
--ignore-glob="**/node_modules/" \
|
||||||
|
--ignore=node_modules/ \
|
||||||
-W ignore::sqlalchemy.exc.SADeprecationWarning \
|
-W ignore::sqlalchemy.exc.SADeprecationWarning \
|
||||||
-W ignore::sqlalchemy.exc.SAWarning \
|
-W ignore::sqlalchemy.exc.SAWarning \
|
||||||
-n auto
|
-n auto
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ pytest-xdist==1.32.0
|
|||||||
pytest-cov==2.9.0
|
pytest-cov==2.9.0
|
||||||
sphinx_rtd_theme==0.4.3
|
sphinx_rtd_theme==0.4.3
|
||||||
flask-debugtoolbar==0.11.0
|
flask-debugtoolbar==0.11.0
|
||||||
|
isort==4.3.21
|
||||||
flake8-isort==3.0.0
|
flake8-isort==3.0.0
|
||||||
Faker==4.1.0
|
Faker==4.1.0
|
||||||
pipdeptree==0.13.2
|
pipdeptree==0.13.2
|
||||||
|
|||||||
@@ -244,6 +244,21 @@ def test_api_challenge_get_visibility_private():
|
|||||||
destroy_ctfd(app)
|
destroy_ctfd(app)
|
||||||
|
|
||||||
|
|
||||||
|
def test_api_challenge_get_with_admin_only_account_visibility():
|
||||||
|
"""Can a private user get /api/v1/challenges/<challenge_id> if account_visibility is admins_only"""
|
||||||
|
app = create_ctfd()
|
||||||
|
with app.app_context():
|
||||||
|
gen_challenge(app.db)
|
||||||
|
register_user(app)
|
||||||
|
client = login_as_user(app)
|
||||||
|
r = client.get("/api/v1/challenges/1")
|
||||||
|
assert r.status_code == 200
|
||||||
|
set_config("account_visibility", "admins")
|
||||||
|
r = client.get("/api/v1/challenges/1")
|
||||||
|
assert r.status_code == 200
|
||||||
|
destroy_ctfd(app)
|
||||||
|
|
||||||
|
|
||||||
def test_api_challenge_get_ctftime_private():
|
def test_api_challenge_get_ctftime_private():
|
||||||
"""Can a private user get /api/v1/challenges/<challenge_id> if ctftime is over"""
|
"""Can a private user get /api/v1/challenges/<challenge_id> if ctftime is over"""
|
||||||
app = create_ctfd()
|
app = create_ctfd()
|
||||||
|
|||||||
Reference in New Issue
Block a user