From 642ac8d97845f7cdf4b2810900db350d07fd4a1c Mon Sep 17 00:00:00 2001 From: sesheikholeslam Date: Fri, 31 Jul 2020 10:37:33 -0400 Subject: [PATCH] Flag Submission Box Dissapears After Submitting Correct Flag --- app/assets/javascripts/application.js | 1 + app/controllers/challenges_controller.rb | 3 ++- app/views/challenges/show.html.haml | 2 +- 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/app/assets/javascripts/application.js b/app/assets/javascripts/application.js index 7b704463..de856e9b 100644 --- a/app/assets/javascripts/application.js +++ b/app/assets/javascripts/application.js @@ -11,6 +11,7 @@ // GO AFTER THE REQUIRES BELOW. // //= require jquery +//= require jquery_ujs //= require_tree . //= require jquery.nested-fields // Loads all Bootstrap javascripts diff --git a/app/controllers/challenges_controller.rb b/app/controllers/challenges_controller.rb index 49671fcc..04103ef9 100644 --- a/app/controllers/challenges_controller.rb +++ b/app/controllers/challenges_controller.rb @@ -21,10 +21,11 @@ def update @solved_challenge = @flag_found.save_solved_challenge(current_user) @solved_video_url = @flag_found.video_url flash.now[:notice] = I18n.t('flag.accepted') + @solvable = false else flash.now[:alert] = wrong_flag_messages.sample + @solvable = true end - @solvable = @challenge.can_be_solved_by(current_user.team) render :show end diff --git a/app/views/challenges/show.html.haml b/app/views/challenges/show.html.haml index c7b3391b..44a19fe2 100644 --- a/app/views/challenges/show.html.haml +++ b/app/views/challenges/show.html.haml @@ -1,5 +1,5 @@ -# For PentestGames, @challenge here can actually be a flag object since Pentest challenges belong to teams + challenges and are linked by a flag object. --# +-# - content_for :admin_menu do %li= link_to t('challenges.admin_edit_challenge', challengename: @challenge.name), admin_edit_url(@challenge)