From 85b2db7ac104114b11eb7fa13f4eee89e0348c6f Mon Sep 17 00:00:00 2001 From: jingquan huang Date: Sat, 13 Jul 2019 16:26:52 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9D=83=E9=99=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/application_controller.rb | 18 +++++++++--------- app/controllers/challenges_controller.rb | 1 + 2 files changed, 10 insertions(+), 9 deletions(-) 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,