I solved the problem, but it is a little ugly in my opinion. Here is what I did.
In the cookie validation method, I set a session variable indicating the method of entering the cookie.
def login_from_cookie
user = cookies[:auth_token] && User.find_by_remember_token(cookies[:auth_token])
if user && user.remember_token?
session[:cookie_login] = true **
self.current_user = user
handle_remember_cookie! false
self.current_user
end
end
Then in: before_filter set_current_userI just check this variable and redirect it if set to set the variable to zero.
def set_current_user
Authorization.current_user = current_user
if session[:cookie_login]
redirect_to :controller => :users, :action => :search
session[:cookie_login] = false
end
end
It is not very, but it really works. I am definitely open to any suggestions on how to clean this.
user111806
source
share