From 3defc533a22993f7b3cec1b17a161ff74ec4eb39 Mon Sep 17 00:00:00 2001 From: jingquan huang Date: Sun, 22 Sep 2019 17:52:18 +0800 Subject: [PATCH 1/3] =?UTF-8?q?=E7=89=88=E6=9C=AC=E5=BA=93=E9=94=99?= =?UTF-8?q?=E8=AF=AF=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/games_controller.rb | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/app/controllers/games_controller.rb b/app/controllers/games_controller.rb index 4a087ae7a..d72c534a0 100644 --- a/app/controllers/games_controller.rb +++ b/app/controllers/games_controller.rb @@ -477,6 +477,10 @@ class GamesController < ApplicationController tip_exception("代码获取异常,请检查实训模板的评测设置是否正确") else # 报错继续retry + if params[:retry].to_i == 1 + # 如果报错了,并且retry 为1的时候,则fork一个新的仓库 + project_fork(@myshixun, @shixun.repo_path, current_user.login) + end tip_exception(-3, "#{e.message}") end end From a241477100e9e255301952d036cf837256a7e3eb Mon Sep 17 00:00:00 2001 From: jingquan huang Date: Sun, 22 Sep 2019 18:02:29 +0800 Subject: [PATCH 2/3] .. --- app/controllers/games_controller.rb | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/app/controllers/games_controller.rb b/app/controllers/games_controller.rb index d72c534a0..be8173b2f 100644 --- a/app/controllers/games_controller.rb +++ b/app/controllers/games_controller.rb @@ -476,14 +476,13 @@ class GamesController < ApplicationController if @myshixun.shixun.try(:status) < 2 tip_exception("代码获取异常,请检查实训模板的评测设置是否正确") else - # 报错继续retry - if params[:retry].to_i == 1 - # 如果报错了,并且retry 为1的时候,则fork一个新的仓库 - project_fork(@myshixun, @shixun.repo_path, current_user.login) - end tip_exception(-3, "#{e.message}") end end + # 如果报错了,并且retry 为1的时候,则fork一个新的仓库 + if params[:retry].to_i == 1 + project_fork(@myshixun, @shixun.repo_path, current_user.login) + end tip_exception(0, e.message) end end From a5e6ad081af2ce173ce7557f618ee21ddd0b5cc4 Mon Sep 17 00:00:00 2001 From: cxt <853663049@qq.com> Date: Mon, 23 Sep 2019 08:49:57 +0800 Subject: [PATCH 3/3] =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/accounts_controller.rb | 30 +++++++++++------------ app/controllers/application_controller.rb | 16 ++++++++++++ 2 files changed, 31 insertions(+), 15 deletions(-) diff --git a/app/controllers/accounts_controller.rb b/app/controllers/accounts_controller.rb index 46b3964c2..ef30dac83 100644 --- a/app/controllers/accounts_controller.rb +++ b/app/controllers/accounts_controller.rb @@ -127,21 +127,21 @@ class AccountsController < ApplicationController # UserDayCertification.create(user_id: user.id, status: 1) end - def set_autologin_cookie(user) - token = Token.get_or_create_permanent_login_token(user, "autologin") - cookie_options = { - :value => token.value, - :expires => 1.month.from_now, - :path => '/', - :secure => false, - :httponly => true - } - if edu_setting('cookie_domain').present? - cookie_options = cookie_options.merge(domain: edu_setting('cookie_domain')) - end - cookies[autologin_cookie_name] = cookie_options - logger.info("cookies is #{cookies}") - end + # def set_autologin_cookie(user) + # token = Token.get_or_create_permanent_login_token(user, "autologin") + # cookie_options = { + # :value => token.value, + # :expires => 1.month.from_now, + # :path => '/', + # :secure => false, + # :httponly => true + # } + # if edu_setting('cookie_domain').present? + # cookie_options = cookie_options.merge(domain: edu_setting('cookie_domain')) + # end + # cookies[autologin_cookie_name] = cookie_options + # logger.info("cookies is #{cookies}") + # end def logout UserAction.create(action_id: User.current.id, action_type: "Logout", user_id: User.current.id, :ip => request.remote_ip) diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index b6bba1f34..459ba5384 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -620,6 +620,22 @@ class ApplicationController < ActionController::Base cookies[:fileDownload] = true end + def set_autologin_cookie(user) + token = Token.get_or_create_permanent_login_token(user, "autologin") + cookie_options = { + :value => token.value, + :expires => 1.month.from_now, + :path => '/', + :secure => false, + :httponly => true + } + if edu_setting('cookie_domain').present? + cookie_options = cookie_options.merge(domain: edu_setting('cookie_domain')) + end + cookies[autologin_cookie_name] = cookie_options + logger.info("cookies is #{cookies}") + end + # 149课程的评审用户数据创建(包含创建课堂学生) def open_class_user user = User.find_by(login: "OpenClassUser")