mirror of
https://github.com/aljazceru/CTFd.git
synced 2026-02-01 04:14:25 +01:00
Fixing view CTF after end and making it less confusing
This commit is contained in:
@@ -10,8 +10,12 @@ import logging
|
||||
def init_challenges(app):
|
||||
@app.route('/challenges', methods=['GET'])
|
||||
def challenges():
|
||||
if not is_admin() and not ctftime() and not view_after_ctf():
|
||||
return redirect('/')
|
||||
if not is_admin():
|
||||
if not ctftime():
|
||||
if view_after_ctf():
|
||||
pass
|
||||
else:
|
||||
return redirect('/')
|
||||
if can_view_challenges():
|
||||
return render_template('chals.html', ctftime=ctftime())
|
||||
else:
|
||||
@@ -19,8 +23,12 @@ def init_challenges(app):
|
||||
|
||||
@app.route('/chals', methods=['GET'])
|
||||
def chals():
|
||||
if not is_admin() and not ctftime() and not view_after_ctf():
|
||||
return redirect('/')
|
||||
if not is_admin():
|
||||
if not ctftime():
|
||||
if view_after_ctf():
|
||||
pass
|
||||
else:
|
||||
return redirect('/')
|
||||
if can_view_challenges():
|
||||
chals = Challenges.query.add_columns('id', 'name', 'value', 'description', 'category').order_by(Challenges.value).all()
|
||||
|
||||
|
||||
@@ -73,7 +73,7 @@ def admins_only(f):
|
||||
|
||||
|
||||
def view_after_ctf():
|
||||
if get_config('view_after_ctf') == '1' and get_config("end") > time.time:
|
||||
if get_config('view_after_ctf') == '1' and time.time() > int(get_config("end")):
|
||||
return True
|
||||
else:
|
||||
return False
|
||||
@@ -211,4 +211,4 @@ def get_digitalocean():
|
||||
if token:
|
||||
return digitalocean.Manager(token=token)
|
||||
else:
|
||||
return False
|
||||
return False
|
||||
|
||||
Reference in New Issue
Block a user