Merge Dev into Master (#591)

* Chals endpoint seperation (#572)

* Separate the logic of ctftime and email confirmations and admin checking into decorators
* Separate the chals endpoint into /chals and /chals/:id. Closes #552, #435.
* Challenges are now loaded directly from the server before being displayed to the user. 
* Challenge modals now use `{{ description }}` instead of `{{ desc }}`.
* 403 is now a more common status code and can indicate that a CTF has not begun or that you are not logged in. This is in addition to CSRF failures. 
* Update tests to new behavior

* Fixing glitch if an entry chal or team id isn't defined

* Markdown it (#574)

* Replace Marked with Markdown-It

* Update modal change (#576)

* Switch update modals to use nunjucks instead of JS to load in data. 
* Fix previewing challenges after hitting the challenge update button.
* Fix edit-files issue with an unnecessary request.

* Fix solves button

* Closes #592
This commit is contained in:
Kevin Chung
2018-04-16 00:24:04 -04:00
committed by GitHub
parent d17e599193
commit 51d098080f
26 changed files with 575 additions and 403 deletions

View File

@@ -276,7 +276,7 @@ def test_ctftime_prevents_accessing_challenges_before_ctf():
chal_id = chal.id
flag = gen_flag(app.db, chal=chal.id, flag=u'flag')
with freeze_time("2017-10-3"):
with freeze_time("2017-10-3"): # CTF has not started yet.
client = login_as_user(app)
r = client.get('/chals')
assert r.status_code == 403
@@ -288,8 +288,7 @@ def test_ctftime_prevents_accessing_challenges_before_ctf():
}
r = client.post('/chal/{}'.format(chal_id), data=data)
data = r.get_data(as_text=True)
data = json.loads(data)
assert data['status'] == -1
assert r.status_code == 403
solve_count = app.db.session.query(app.db.func.count(Solves.id)).first()[0]
assert solve_count == 0
destroy_ctfd(app)