Devise remember me not storing cookie

匿名 (未验证) 提交于 2019-12-03 01:01:02

问题:

I've set up a simple sample app that uses devise for user authentication.

When I select the rember me checkbox on login I get the following in the console:

I have the following in my Posts controller:

before_filter :authenticate_user!

However, when I close the browser and open it again I am forced to login again before I can view posts. It doesn't seem that the cookie is being stored. I found the following cookie in firefox for my page:

Cookie Name: remember_user_token Expires: at end of session

Is this the cookie thats supposed to be stored and expire at a future date but instead expires at the end of session? Can someone verify this?

I've tried both commenting and uncommenting config.remember_for = 2.weeks in devise.rb to different settings and nothing seems to fix the problem.

My User.rb file looks like this:

class User < ActiveRecord::Base

devise :database_authenticatable, :registerable, :recoverable, :rememberable, :trackable, :validatable

# Setup accessible (or protected) attributes for your model

attr_accessible :email, :password, :password_confirmation, :remember_me

end

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