diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 5336e20c1..f38541f12 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -210,15 +210,15 @@ class ApplicationController < ActionController::Base User.current = User.find 12 end - User.current = User.find 81403 - - # if params[:debug] == 'teacher' #todo 为了测试,记得讲debug删除 - # User.current = User.find 81403 - # elsif params[:debug] == 'student' - # User.current = User.find 8686 - # elsif params[:debug] == 'admin' - # User.current = User.find 1 - # end + # User.current = User.find 81403 + + if params[:debug] == 'teacher' #todo 为了测试,记得讲debug删除 + User.current = User.find 81403 + elsif params[:debug] == 'student' + User.current = User.find 8686 + elsif params[:debug] == 'admin' + User.current = User.find 1 + end end # Sets the logged in user diff --git a/app/controllers/challenges_controller.rb b/app/controllers/challenges_controller.rb index 33963a192..36b0e66d3 100644 --- a/app/controllers/challenges_controller.rb +++ b/app/controllers/challenges_controller.rb @@ -1,5 +1,6 @@ class ChallengesController < ApplicationController before_action :require_login + before_action :check_auth before_action :find_shixun, only: [:new, :create, :index] skip_before_action :verify_authenticity_token, only: [:create, :update, :create_choose_question, :crud_answer] before_action :find_challenge, only: [:edit, :show, :update, :create_choose_question, :index_down, :index_up,