3.0.0a2 dev (#1528)

# 3.0.0a2 / 2020-07-09

**General**

* Accept additional profile fields during registration (affiliation, website, country)
  * This does not add additional inputs. Themes or additional JavaScript can add the form inputs.

**Admin Panel**

* Redesign the challenge creation form to use a radio button with challenge type selection instead of a select input

**API**

* Admins can no longer ban themselves through `PATCH /api/v1/users/[user_id]`

**Themes**

* Spinner centering has been switched from a hard coded margin in CSS to flexbox CSS classes from Bootstrap

**Plugins**

* Revert plugin menu (`register_admin_plugin_menu_bar`, `register_user_page_menu_bar`) changes to 2.x code

**Miscellaneous**

* Fix issue with `Configs.ctf_name` returning incorrect value
* Add prerender step back into challenges.js
* Better handling of missing challenge types. Missing challenge types no longer bring down all other challenges.
This commit is contained in:
Kevin Chung
2020-07-09 13:40:35 -04:00
committed by GitHub
parent 1bccbf1fdd
commit 1725e632cf
37 changed files with 399 additions and 163 deletions

View File

@@ -1,8 +1,8 @@
from flask import render_template, request, url_for
from flask import abort, render_template, request, url_for
from CTFd.admin import admin
from CTFd.models import Challenges, Flags, Solves
from CTFd.plugins.challenges import get_chal_class
from CTFd.plugins.challenges import CHALLENGE_CLASSES, get_chal_class
from CTFd.utils.decorators import admins_only
@@ -44,7 +44,14 @@ def challenges_detail(challenge_id):
.all()
)
flags = Flags.query.filter_by(challenge_id=challenge.id).all()
challenge_class = get_chal_class(challenge.type)
try:
challenge_class = get_chal_class(challenge.type)
except KeyError:
abort(
500,
f"The underlying challenge type ({challenge.type}) is not installed. This challenge can not be loaded.",
)
update_j2 = render_template(
challenge_class.templates["update"].lstrip("/"), challenge=challenge
@@ -67,4 +74,5 @@ def challenges_detail(challenge_id):
@admin.route("/admin/challenges/new")
@admins_only
def challenges_new():
return render_template("admin/challenges/new.html")
types = CHALLENGE_CLASSES.keys()
return render_template("admin/challenges/new.html", types=types)