invalidate a cookie on password change
I use cookies to manage user sessions in my Rails app. I recently found that when a user changes the password, the cookie does not 开发者_JAVA百科get invalidated as expected. As you realize, this could be a great threat to security. How should I handle this problem? I want to expire or invalidate a cookie once the user changes the password. How do I do this in Rails. Thanks.
Destroy the session as you would on a logout; and ask the user to log back in.
http://api.rubyonrails.org/classes/ActionController/Base.html#M000474
精彩评论