From c48ed86bc76658ac91a1c889a988b8a045723bfc Mon Sep 17 00:00:00 2001 From: jingquan huang Date: Sat, 13 Jul 2019 15:48:54 +0800 Subject: [PATCH 1/4] add . --- app/controllers/application_controller.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index b8fe7d723..48ea8eb59 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -210,7 +210,7 @@ class ApplicationController < ActionController::Base end if params[:debug] == 'teacher' #todo 为了测试,记得讲debug删除 - User.current = User.find 49610 + User.current = User.find_by_phone("153880833362") elsif params[:debug] == 'student' User.current = User.find 8686 elsif params[:debug] == 'admin' From 80fa5538663a7f24d9f8ef96bf6aa72835a80e45 Mon Sep 17 00:00:00 2001 From: jingquan huang Date: Sat, 13 Jul 2019 15:57:02 +0800 Subject: [PATCH 2/4] =?UTF-8?q?=E6=B5=8B=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/application_controller.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 3bdd0d1b0..6a85984ca 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -211,7 +211,7 @@ class ApplicationController < ActionController::Base end if params[:debug] == 'teacher' #todo 为了测试,记得讲debug删除 - User.current = User.find_by_phone("153880833362") + User.current = User.find 81403 elsif params[:debug] == 'student' User.current = User.find 8686 elsif params[:debug] == 'admin' From 6bbb8e050e1e0f22456bfb98b8ea88b5ed06c40d Mon Sep 17 00:00:00 2001 From: jingquan huang Date: Sat, 13 Jul 2019 16:10:01 +0800 Subject: [PATCH 3/4] =?UTF-8?q?..=E6=B5=8B=E8=AF=95=E7=94=A8=E6=88=B7?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/application_controller.rb | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 6a85984ca..5336e20c1 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -210,13 +210,15 @@ class ApplicationController < ActionController::Base User.current = User.find 12 end - 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 From 85b2db7ac104114b11eb7fa13f4eee89e0348c6f Mon Sep 17 00:00:00 2001 From: jingquan huang Date: Sat, 13 Jul 2019 16:26:52 +0800 Subject: [PATCH 4/4] =?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,