From 275b8f9170982126bee2050bcefff4894c92cd32 Mon Sep 17 00:00:00 2001 From: jingquan huang Date: Wed, 20 Nov 2019 11:48:22 +0800 Subject: [PATCH 01/27] domain test --- app/controllers/application_controller.rb | 6 ++++-- app/controllers/concerns/login_helper.rb | 12 +++++++++++- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 1bc2bad7d..32714bf87 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -292,9 +292,11 @@ class ApplicationController < ActionController::Base # and starts a session if needed def find_current_user uid_logger("user setup start: session[:user_id] is #{session[:user_id]}") - if session[:user_id] + + Rails.logger.info("find current_user: subdomain is #{request.subdomain} and user session is #{session[:user_id]} -- #{session[:"#{request.subdomain}_user_id"]}") + if session[:"#{request.subdomain}_user_id"] # existing session - (User.active.find(session[:user_id]) rescue nil) + (User.active.find(session[:"#{request.subdomain}_user_id"]) rescue nil) elsif autologin_user = try_to_autologin autologin_user elsif params[:format] == 'atom' && params[:key] && request.get? && accept_rss_auth? diff --git a/app/controllers/concerns/login_helper.rb b/app/controllers/concerns/login_helper.rb index e94cf8a21..a95723690 100644 --- a/app/controllers/concerns/login_helper.rb +++ b/app/controllers/concerns/login_helper.rb @@ -62,7 +62,17 @@ module LoginHelper end def start_user_session(user) - session[:user_id] = user.id + session[:"#{request.subdomain}_user_id"] = user.id + Rails.logger.info("domain_user_id session is: 3333332222111#{session[:"#{request.subdomain}_user_id"]}") + Rails.logger.info("user_id session is: 3333332222111#{session[:"#{request.subdomain}_user_id"]}") + + # if current_laboratory.main_site? + # session[:user_id] = user.id + # else + # session[:"#{request.subdomain}_user_id"] = user.id + # end + + # session[:user_id] = user.id session[:ctime] = Time.now.utc.to_i session[:atime] = Time.now.utc.to_i end From e64cdfb171c74133537e4e83e9eff7e6b4b86b45 Mon Sep 17 00:00:00 2001 From: jingquan huang Date: Wed, 20 Nov 2019 14:21:28 +0800 Subject: [PATCH 02/27] test --- app/controllers/application_controller.rb | 2 ++ 1 file changed, 2 insertions(+) diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 32714bf87..10a326fef 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -292,6 +292,8 @@ class ApplicationController < ActionController::Base # and starts a session if needed def find_current_user uid_logger("user setup start: session[:user_id] is #{session[:user_id]}") + uid_logger("user setup start2: session[:user_aa_id] is #{session[:user_aa_id]}") + uid_logger("user setup start3: session[:user_aa_id] is #{session[:aa.pre_aa_id]}") Rails.logger.info("find current_user: subdomain is #{request.subdomain} and user session is #{session[:user_id]} -- #{session[:"#{request.subdomain}_user_id"]}") if session[:"#{request.subdomain}_user_id"] From c8888bc0fedf20f8982357230460def60d313125 Mon Sep 17 00:00:00 2001 From: jingquan huang Date: Wed, 20 Nov 2019 14:24:02 +0800 Subject: [PATCH 03/27] .. --- app/controllers/application_controller.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 10a326fef..25e658c53 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -293,7 +293,8 @@ class ApplicationController < ActionController::Base def find_current_user uid_logger("user setup start: session[:user_id] is #{session[:user_id]}") uid_logger("user setup start2: session[:user_aa_id] is #{session[:user_aa_id]}") - uid_logger("user setup start3: session[:user_aa_id] is #{session[:aa.pre_aa_id]}") + uid_logger("user setup start3: session[:user_aa_id] is #{session[:"#{request.subdomain}"]}") + uid_logger("user setup start3: session[:user_aa_id] is #{session[:"#{request.subdomain}_user_id"]}") Rails.logger.info("find current_user: subdomain is #{request.subdomain} and user session is #{session[:user_id]} -- #{session[:"#{request.subdomain}_user_id"]}") if session[:"#{request.subdomain}_user_id"] From c9b746c1bd0688d9c6e75ca34eb1010aa3a09c27 Mon Sep 17 00:00:00 2001 From: jingquan huang Date: Wed, 20 Nov 2019 14:28:34 +0800 Subject: [PATCH 04/27] test --- 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 25e658c53..9d0a0e44a 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -294,7 +294,7 @@ class ApplicationController < ActionController::Base uid_logger("user setup start: session[:user_id] is #{session[:user_id]}") uid_logger("user setup start2: session[:user_aa_id] is #{session[:user_aa_id]}") uid_logger("user setup start3: session[:user_aa_id] is #{session[:"#{request.subdomain}"]}") - uid_logger("user setup start3: session[:user_aa_id] is #{session[:"#{request.subdomain}_user_id"]}") + uid_logger("user setup start3: session[:user_aa_id] is #{session[:"#{request.subdomain.split('.').first}_user_id"]}") Rails.logger.info("find current_user: subdomain is #{request.subdomain} and user session is #{session[:user_id]} -- #{session[:"#{request.subdomain}_user_id"]}") if session[:"#{request.subdomain}_user_id"] From e8f0b07b927ad8348c804c3202854318399e8df9 Mon Sep 17 00:00:00 2001 From: jingquan huang Date: Wed, 20 Nov 2019 14:36:23 +0800 Subject: [PATCH 05/27] session id --- app/controllers/application_controller.rb | 11 ++++------- app/controllers/concerns/login_helper.rb | 7 ++++--- 2 files changed, 8 insertions(+), 10 deletions(-) diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 9d0a0e44a..6721d7445 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -291,15 +291,12 @@ class ApplicationController < ActionController::Base # Returns the current user or nil if no user is logged in # and starts a session if needed def find_current_user - uid_logger("user setup start: session[:user_id] is #{session[:user_id]}") - uid_logger("user setup start2: session[:user_aa_id] is #{session[:user_aa_id]}") - uid_logger("user setup start3: session[:user_aa_id] is #{session[:"#{request.subdomain}"]}") - uid_logger("user setup start3: session[:user_aa_id] is #{session[:"#{request.subdomain.split('.').first}_user_id"]}") + re_subdomain = "#{request.subdomain.split('.').first}_user_id" - Rails.logger.info("find current_user: subdomain is #{request.subdomain} and user session is #{session[:user_id]} -- #{session[:"#{request.subdomain}_user_id"]}") - if session[:"#{request.subdomain}_user_id"] + Rails.logger.info("find current_user: subdomain is #{request.subdomain} and user session is #{session[:user_id]} -- #{session[:"#{re_subdomain}"]}") + if session[:"#{re_subdomain}"] # existing session - (User.active.find(session[:"#{request.subdomain}_user_id"]) rescue nil) + (User.active.find(session[:"#{re_subdomain}"]) rescue nil) elsif autologin_user = try_to_autologin autologin_user elsif params[:format] == 'atom' && params[:key] && request.get? && accept_rss_auth? diff --git a/app/controllers/concerns/login_helper.rb b/app/controllers/concerns/login_helper.rb index a95723690..4e51db9c6 100644 --- a/app/controllers/concerns/login_helper.rb +++ b/app/controllers/concerns/login_helper.rb @@ -62,9 +62,10 @@ module LoginHelper end def start_user_session(user) - session[:"#{request.subdomain}_user_id"] = user.id - Rails.logger.info("domain_user_id session is: 3333332222111#{session[:"#{request.subdomain}_user_id"]}") - Rails.logger.info("user_id session is: 3333332222111#{session[:"#{request.subdomain}_user_id"]}") + re_subdomain = "#{request.subdomain.split('.').first}_user_id" + session[:"#{re_subdomai}"] = user.id + Rails.logger.info("domain_user_id session is: 3333332222111#{session[:"#{re_subdomai}"]}") + Rails.logger.info("user_id session is: 3333332222111#{session[:user_id]}") # if current_laboratory.main_site? # session[:user_id] = user.id From 57e8bb59d607eeac2d04280c7bee6e921b321326 Mon Sep 17 00:00:00 2001 From: jingquan huang Date: Wed, 20 Nov 2019 14:38:04 +0800 Subject: [PATCH 06/27] session domain check --- app/controllers/concerns/login_helper.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/controllers/concerns/login_helper.rb b/app/controllers/concerns/login_helper.rb index 4e51db9c6..231812527 100644 --- a/app/controllers/concerns/login_helper.rb +++ b/app/controllers/concerns/login_helper.rb @@ -63,8 +63,8 @@ module LoginHelper def start_user_session(user) re_subdomain = "#{request.subdomain.split('.').first}_user_id" - session[:"#{re_subdomai}"] = user.id - Rails.logger.info("domain_user_id session is: 3333332222111#{session[:"#{re_subdomai}"]}") + session[:"#{re_subdomain}"] = user.id + Rails.logger.info("domain_user_id session is: 3333332222111#{session[:"#{re_subdomain}"]}") Rails.logger.info("user_id session is: 3333332222111#{session[:user_id]}") # if current_laboratory.main_site? From cc76f56969cbc45cac5fefa501ea220c719dc061 Mon Sep 17 00:00:00 2001 From: jingquan huang Date: Wed, 20 Nov 2019 14:53:28 +0800 Subject: [PATCH 07/27] .. --- app/controllers/application_controller.rb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 6721d7445..adef28e03 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -293,7 +293,9 @@ class ApplicationController < ActionController::Base def find_current_user re_subdomain = "#{request.subdomain.split('.').first}_user_id" - Rails.logger.info("find current_user: subdomain is #{request.subdomain} and user session is #{session[:user_id]} -- #{session[:"#{re_subdomain}"]}") + Rails.logger.info("find current_user: subdomain is #{re_subdomain} and user session is #{session[:user_id]} -- #{session[:"#{re_subdomain}"]}") + Rails.logger.info("-----------------------------") + Rails.logger.info("domain session is: #{session[:"#{request.subdomain.split('.').first}_user_id"]}") if session[:"#{re_subdomain}"] # existing session (User.active.find(session[:"#{re_subdomain}"]) rescue nil) From 062966313365626d945d5f3d610aa3403c244a79 Mon Sep 17 00:00:00 2001 From: jingquan huang Date: Wed, 20 Nov 2019 15:20:51 +0800 Subject: [PATCH 08/27] test --- app/controllers/concerns/login_helper.rb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app/controllers/concerns/login_helper.rb b/app/controllers/concerns/login_helper.rb index 231812527..f9e0255d2 100644 --- a/app/controllers/concerns/login_helper.rb +++ b/app/controllers/concerns/login_helper.rb @@ -63,7 +63,9 @@ module LoginHelper def start_user_session(user) re_subdomain = "#{request.subdomain.split('.').first}_user_id" - session[:"#{re_subdomain}"] = user.id + + session[:"#{re_subdomain}"] = nil + # session[:"#{re_subdomain}"] = user.id Rails.logger.info("domain_user_id session is: 3333332222111#{session[:"#{re_subdomain}"]}") Rails.logger.info("user_id session is: 3333332222111#{session[:user_id]}") From 3f539a90f59488494ae3d4e2e633a20b63d476a7 Mon Sep 17 00:00:00 2001 From: jingquan huang Date: Wed, 20 Nov 2019 15:22:08 +0800 Subject: [PATCH 09/27] .. --- app/controllers/concerns/login_helper.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/app/controllers/concerns/login_helper.rb b/app/controllers/concerns/login_helper.rb index f9e0255d2..0126eb6b0 100644 --- a/app/controllers/concerns/login_helper.rb +++ b/app/controllers/concerns/login_helper.rb @@ -65,6 +65,7 @@ module LoginHelper re_subdomain = "#{request.subdomain.split('.').first}_user_id" session[:"#{re_subdomain}"] = nil + session[:user_id] = nil # session[:"#{re_subdomain}"] = user.id Rails.logger.info("domain_user_id session is: 3333332222111#{session[:"#{re_subdomain}"]}") Rails.logger.info("user_id session is: 3333332222111#{session[:user_id]}") From c6a70bd1b2e9a440005605a7121884053bff3887 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=98=8E?= <775174143@qq.com> Date: Wed, 20 Nov 2019 16:43:03 +0800 Subject: [PATCH 10/27] =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/react/src/modules/user/LoginRegisterComponent.js | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/public/react/src/modules/user/LoginRegisterComponent.js b/public/react/src/modules/user/LoginRegisterComponent.js index 929b21cec..1fbfe4e35 100644 --- a/public/react/src/modules/user/LoginRegisterComponent.js +++ b/public/react/src/modules/user/LoginRegisterComponent.js @@ -154,7 +154,7 @@ class LoginRegisterComponent extends Component { // console.log(this.props); let pcipns=this.IsPC(); if (this.props.match.url === "/login") { - console.log("11111111111111111111111111"); + // this.state = { // tab:["0"], // @@ -163,7 +163,7 @@ class LoginRegisterComponent extends Component { tab:["0"] }) } else if (this.props.match.url === "/register") { - console.log("11111111111111111111111111"); + // this.state = { // tab:["1"], // @@ -968,6 +968,7 @@ class LoginRegisterComponent extends Component { // window.location.href='http://www.cnblogs.com/a-cat/'; } + return (
this.postLogin()} size={"large"}>登录 - {this.props.user&&this.props.user.main_site===true?this.state.isphone===true?

+ {this.props.mygetHelmetapi&&this.props.mygetHelmetapi.main_site===true?this.state.isphone===true?

———————— 快速登录 ————————

@@ -1252,7 +1253,7 @@ class LoginRegisterComponent extends Component { - {this.props.user&&this.props.user.main_site===true?this.state.isphone===true?

+ {this.props.mygetHelmetapi&&this.props.mygetHelmetapi.main_site===true?this.state.isphone===true?

———————— 快速登录 ————————

From 64147444fd20874d762942b4359580aa4c01f768 Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Wed, 20 Nov 2019 16:47:52 +0800 Subject: [PATCH 11/27] =?UTF-8?q?=E7=A7=81=E5=AF=86=E7=89=88=E6=9C=AC?= =?UTF-8?q?=E5=BA=93=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/gits_controller.rb | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/app/controllers/gits_controller.rb b/app/controllers/gits_controller.rb index c9659302e..e87f3302f 100644 --- a/app/controllers/gits_controller.rb +++ b/app/controllers/gits_controller.rb @@ -49,6 +49,10 @@ class GitsController < ApplicationController repo_name = username + "/" + shixunname uid_logger("git start: repo_name is #{repo_name}") shixun = Shixun.select([:id, :user_id, :repo_name, :identifier]).where(repo_name: repo_name).first + if shixun.blank? + shixun_id = ShixunSecretRepository.where(repo_name: repo_name).pluck(:shixun_id).first + shixun = Shixun.select([:id, :user_id, :repo_name, :identifier]).find_by(id: shixun_id) + end uid_logger("git start auth: shixun identifier is #{shixun.try(:identifier)}") uid_logger("git start auth: systemuser is #{system_user.try(:login)}") From 0d54bd2325691fbe09954a75a8c29f48fed81789 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=98=8E?= <775174143@qq.com> Date: Wed, 20 Nov 2019 16:48:43 +0800 Subject: [PATCH 12/27] =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/react/src/modules/home/shixunsHome.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/public/react/src/modules/home/shixunsHome.js b/public/react/src/modules/home/shixunsHome.js index 6971cf36c..2efacf29e 100644 --- a/public/react/src/modules/home/shixunsHome.js +++ b/public/react/src/modules/home/shixunsHome.js @@ -242,7 +242,7 @@ class ShixunsHome extends Component {
更多 -
+
{homedatalist===undefined?"":homedatalist.subjects.map((item,key)=>{ @@ -321,7 +321,7 @@ class ShixunsHome extends Component {
更多 -
+