|
|
@ -14,6 +14,7 @@ class ApplicationController < ActionController::Base
|
|
|
|
#before_action :check_account
|
|
|
|
#before_action :check_account
|
|
|
|
|
|
|
|
|
|
|
|
DCODES = %W(2 3 4 5 6 7 8 9 a b c f e f g h i j k l m n o p q r s t u v w x y z)
|
|
|
|
DCODES = %W(2 3 4 5 6 7 8 9 a b c f e f g h i j k l m n o p q r s t u v w x y z)
|
|
|
|
|
|
|
|
OPENKEY = "79e33abd4b6588941ab7622aed1e67e8"
|
|
|
|
|
|
|
|
|
|
|
|
helper_method :current_user
|
|
|
|
helper_method :current_user
|
|
|
|
|
|
|
|
|
|
|
@ -246,6 +247,16 @@ class ApplicationController < ActionController::Base
|
|
|
|
User.current = find_current_user
|
|
|
|
User.current = find_current_user
|
|
|
|
uid_logger("user_setup: " + (User.current.logged? ? "#{User.current.try(:login)} (id=#{User.current.try(:id)})" : "anonymous"))
|
|
|
|
uid_logger("user_setup: " + (User.current.logged? ? "#{User.current.try(:login)} (id=#{User.current.try(:id)})" : "anonymous"))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# 开放课程通过链接访问的用户
|
|
|
|
|
|
|
|
if !User.current.logged? && !params[:chinaoocTimestamp].blank? && !params[:websiteName].blank? && !params[:chinaoocKey].blank?
|
|
|
|
|
|
|
|
content = "#{OPENKEY}#{params[:websiteName]}#{params[:chinaoocTimestamp]}"
|
|
|
|
|
|
|
|
if Digest::MD5.hexdigest(content) == params[:chinaoocKey]
|
|
|
|
|
|
|
|
user = User.open_class_user
|
|
|
|
|
|
|
|
start_user_session(user) if user
|
|
|
|
|
|
|
|
User.current = user
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
if !User.current.logged? && Rails.env.development?
|
|
|
|
if !User.current.logged? && Rails.env.development?
|
|
|
|
User.current = User.find 1
|
|
|
|
User.current = User.find 1
|
|
|
|
end
|
|
|
|
end
|
|
|
|