def auth(problem_id): problem = Problem.query.get_or_404(problem_id) flag = request.form.get('flag') if problem.check_flag(flag): if current_user.solved(problem): flash('Correct, but you already solved this problem.', 'success') return redirect(url_for('frontend.problem', problem_id=problem.id)) else: current_user.solve(problem) db.session.commit() flash('Correct, Congratulations!', 'success') return redirect(url_for('frontend.problem', problem_id=problem.id)) else: flash('Wrong, try again.', 'danger') return redirect(url_for('frontend.problem', problem_id=problem.id))
def problem(problem_id): problem = Problem.query.get_or_404(problem_id) return render_template('problem.html', problem=problem, solved=current_user.solved(problem))