mirror of
https://github.com/aljazceru/CTFd.git
synced 2025-12-17 14:04:20 +01:00
Added info for challenges page Admins Only mode (#2138)
* Added info stating "Challenges are set to Admins Only mode" for admins in relevant case so they don't forget as per issue #2137 * Closes #2137 Co-authored-by: Kevin Chung <kchung@ctfd.io>
This commit is contained in:
@@ -33,6 +33,9 @@ def listing():
|
|||||||
infos = get_infos()
|
infos = get_infos()
|
||||||
errors = get_errors()
|
errors = get_errors()
|
||||||
|
|
||||||
|
if Configs.challenge_visibility == ChallengeVisibilityTypes.ADMINS:
|
||||||
|
infos.append("Challenge Visibility is set to Admins Only")
|
||||||
|
|
||||||
if ctf_started() is False:
|
if ctf_started() is False:
|
||||||
errors.append(f"{Configs.ctf_name} has not started yet")
|
errors.append(f"{Configs.ctf_name} has not started yet")
|
||||||
|
|
||||||
|
|||||||
@@ -73,7 +73,13 @@ def check_challenge_visibility(f):
|
|||||||
return f(*args, **kwargs)
|
return f(*args, **kwargs)
|
||||||
else:
|
else:
|
||||||
if authed():
|
if authed():
|
||||||
abort(403)
|
if request.content_type == "application/json":
|
||||||
|
abort(403)
|
||||||
|
else:
|
||||||
|
abort(
|
||||||
|
403,
|
||||||
|
description="Challenge Visibility is set to Admins Only",
|
||||||
|
)
|
||||||
else:
|
else:
|
||||||
return redirect(url_for("auth.login", next=request.full_path))
|
return redirect(url_for("auth.login", next=request.full_path))
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user