session的一些改造

chromesetting
jingquan huang 5 years ago
parent ab5d363257
commit 35139cb15c

@ -60,7 +60,8 @@ class AccountsController < ApplicationController
ua = UserAgent.find_by_ip(ip)
ua.update_column(:agent_type, UserAgent::USER_REGISTER) if ua
successful_authentication(@user)
session[:user_id] = @user.id
# session[:user_id] = @user.id
session[:"#{default_yun_session}"] = @user.id
normal_status("注册成功")
end
rescue Exception => e
@ -158,7 +159,7 @@ class AccountsController < ApplicationController
def logout
UserAction.create(action_id: User.current.id, action_type: "Logout", user_id: User.current.id, :ip => request.remote_ip)
session[:user_id] = nil
session[:"#{default_yun_session}"] = nil
logout_user
render :json => {status: 1, message: "退出成功!"}
end

@ -47,7 +47,7 @@ module LoginHelper
User.current.delete_session_token(session[:tk])
self.logged_user = nil
end
session[:user_id] = nil
session[:"#{default_yun_session}"] = nil
end
# Sets the logged in user

@ -12,7 +12,8 @@ class Oauth::BaseController < ActionController::Base
private
def session_user_id
session[:user_id]
# session[:user_id]
session[:"#{default_yun_session}"]
end
def current_user

@ -48,7 +48,8 @@ class Weapps::RegistersController < Weapps::BaseController
)
end
successful_authentication(@user)
session[:user_id] = @user.id
# session[:user_id] = @user.id
session[:"#{default_yun_session}"] = @user.id
render_ok
end

Loading…
Cancel
Save