

@blueprint.route('/submit', methods=['POST'])
@api_wrapper
@check_csrf
@require_login
@block_before_competition(WebError('The competition has not begun yet!'))
@block_after_competition(WebError('The competition is over!'))
def submit_key_hook():
    user_account = api.user.get_user()
    tid = user_account['tid']
    uid = user_account['uid']
    pid = request.form.get('pid', '')
    key = request.form.get('key', '')
    ip = request.remote_addr
    result = api.problem.submit_key(tid, pid, key, uid, ip)
    if result['correct']:
        return WebSuccess(result['message'], result['points'])
    else:
        return WebError(result['message'], {
            'code': 'wrong',
        })

dataset/ETHPy150Open IceCTF/ctf-platform/api/api/routes/problem.py submit_key_hook/original