修复了刷新实训相关页面出现500的bug

dev_partners
Alec Zhou 6 years ago
parent 95e1bc759c
commit 4ee0b2a865

@ -1141,4 +1141,9 @@ class ApplicationController < ActionController::Base
redirect_to authorize_url redirect_to authorize_url
end end
def user_login_and_from_openi
url = request.referer.nil? ? Redmine::Configuration['educoder_domain'] : request.referer
URI(url).host == 'openi.org.cn' && !current_user.logged?
end
end end

@ -1,6 +1,8 @@
# encoding: utf-8 # encoding: utf-8
class ChallengesController < ApplicationController class ChallengesController < ApplicationController
layout "base_shixun" layout "base_shixun"
# 如要添加或修改before_filter时请将handle_openi_request这个before_filter放至第一位
before_filter :handle_openi_request, if: -> { user_login_and_from_openi }
before_filter :check_authentication, :except => [:index] before_filter :check_authentication, :except => [:index]
before_filter :find_shixun, :only => [:index, :new, :create, :destroy, :challenge_build, :update_evaluation, :add_choose_question, :new_choose_question, before_filter :find_shixun, :only => [:index, :new, :create, :destroy, :challenge_build, :update_evaluation, :add_choose_question, :new_choose_question,
:choose_type_show, :edit_choose_question, :update_choose_question, :destroy_challenge_choose] :choose_type_show, :edit_choose_question, :update_choose_question, :destroy_challenge_choose]

@ -3,7 +3,7 @@
class ShixunsController < ApplicationController class ShixunsController < ApplicationController
layout 'base_shixun' layout 'base_shixun'
# 如要添加或修改before_filter时请将handle_openi_request这个before_filter放至第一位 # 如要添加或修改before_filter时请将handle_openi_request这个before_filter放至第一位
before_filter :handle_openi_request, if: -> {URI(request.referer).host == 'openi.org.cn' && !current_user.logged?} before_filter :handle_openi_request, if: -> { user_login_and_from_openi }
before_filter :require_login, :except => [:ghook, :download_file, :show, :index] before_filter :require_login, :except => [:ghook, :download_file, :show, :index]
before_filter :check_authentication, :except => [:ghook, :download_file, :show, :index] before_filter :check_authentication, :except => [:ghook, :download_file, :show, :index]
before_filter :find_shixun, :except => [ :index, :new, :create, :index, :search, :shixun_courses, :new_disscuss, :shixun_migrate, :qrcode, :download_file, :departments, :get_mirror_script, :send_message_to_administrator] before_filter :find_shixun, :except => [ :index, :new, :create, :index, :search, :shixun_courses, :new_disscuss, :shixun_migrate, :qrcode, :download_file, :departments, :get_mirror_script, :send_message_to_administrator]

@ -2,7 +2,7 @@
class SubjectsController < ApplicationController class SubjectsController < ApplicationController
layout 'base_subject' layout 'base_subject'
# 如要添加或修改before_filter时请将handle_openi_request这个before_filter放至第一位 # 如要添加或修改before_filter时请将handle_openi_request这个before_filter放至第一位
before_filter :handle_openi_request, if: -> {URI(request.referer).host == 'openi.org.cn' && !current_user.logged?} before_filter :handle_openi_request, if: -> { user_login_and_from_openi }
before_filter :require_login, :except => [:show, :index] before_filter :require_login, :except => [:show, :index]
before_filter :check_authentication, :except => [:show, :index] before_filter :check_authentication, :except => [:show, :index]
before_filter :find_subject, :except => [:index, :new, :create, :create_subject, :new_subject, :append_to_stage, :send_to_course] before_filter :find_subject, :except => [:index, :new, :create, :create_subject, :new_subject, :append_to_stage, :send_to_course]

Loading…
Cancel
Save