How can I get authlogic to use the Rails session instead of its own cookie?

喜欢而已 提交于 2019-12-19 18:54:22

问题


I would like authogic to never set a user_credentials cookie, and only use the standard Rails session cookie.

I see Session is included in Authlogic::Session::Session::Base after Cookies. If I log into my app and then delete the user_credentials cookie, I still stay logged in. So apparently authlogic is storing the credentials in both places and checking both places? Or ignoring the cookie but still setting it? How can I have it never set or reference the user_credentials cookie?


回答1:


According to the answer to my question here…

How can I remove callbacks inserted by vendor code?

…the answer to THIS question is to do this above my UserSession definition:

Authlogic::Session::Base.after_save.delete_if{ |callback| callback.method == :save_cookie }
class UserSession < Authlogic::Session::Base
end



回答2:


If you use vendored authlogic then you can prevent to user_credentials cookie by using and change some code on save_cookie method on "authlogic-2.1.5/lib/authlogic/session/cookies.rb"



来源:https://stackoverflow.com/questions/3162867/how-can-i-get-authlogic-to-use-the-rails-session-instead-of-its-own-cookie

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!