dev_cs
cxt 5 years ago
parent a241477100
commit a5e6ad081a

@ -127,21 +127,21 @@ class AccountsController < ApplicationController
# UserDayCertification.create(user_id: user.id, status: 1) # UserDayCertification.create(user_id: user.id, status: 1)
end end
def set_autologin_cookie(user) # def set_autologin_cookie(user)
token = Token.get_or_create_permanent_login_token(user, "autologin") # token = Token.get_or_create_permanent_login_token(user, "autologin")
cookie_options = { # cookie_options = {
:value => token.value, # :value => token.value,
:expires => 1.month.from_now, # :expires => 1.month.from_now,
:path => '/', # :path => '/',
:secure => false, # :secure => false,
:httponly => true # :httponly => true
} # }
if edu_setting('cookie_domain').present? # if edu_setting('cookie_domain').present?
cookie_options = cookie_options.merge(domain: edu_setting('cookie_domain')) # cookie_options = cookie_options.merge(domain: edu_setting('cookie_domain'))
end # end
cookies[autologin_cookie_name] = cookie_options # cookies[autologin_cookie_name] = cookie_options
logger.info("cookies is #{cookies}") # logger.info("cookies is #{cookies}")
end # end
def logout def logout
UserAction.create(action_id: User.current.id, action_type: "Logout", user_id: User.current.id, :ip => request.remote_ip) UserAction.create(action_id: User.current.id, action_type: "Logout", user_id: User.current.id, :ip => request.remote_ip)

@ -620,6 +620,22 @@ class ApplicationController < ActionController::Base
cookies[:fileDownload] = true cookies[:fileDownload] = true
end 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课程的评审用户数据创建包含创建课堂学生 # 149课程的评审用户数据创建包含创建课堂学生
def open_class_user def open_class_user
user = User.find_by(login: "OpenClassUser") user = User.find_by(login: "OpenClassUser")

Loading…
Cancel
Save