Remember me (Devise) not working for me.

1,333 views
Skip to first unread message

Fahim Patel

unread,
Jul 30, 2013, 3:48:16 AM7/30/13
to rubyonra...@googlegroups.com
Hi all,

I have setup all the devise configuration. But facing issue in remember me.
I check remember me checkbox before sign in and I can see cookie is created and user table is also get updated .

But when I logout no sign in detail is present in email and password input box , and cookie also get destroyed.

I uncomment below line code also -
# The time the user will be remembered without asking for credentials again.
  config.remember_for = 2.weeks

Thanks for help.


Best Regards
Fahim Babar Patel




Fahim Patel

unread,
Jul 30, 2013, 4:02:34 AM7/30/13
to rubyonra...@googlegroups.com
When I sign_in then save password prompt occur and when I save it and logout then I can see email and password is present there.
Don't know why it is not working with remember me check box ?

Any help will appreciate.

Thanks

bacrossland

unread,
Jul 30, 2013, 9:21:25 PM7/30/13
to rubyonra...@googlegroups.com
Hi Fahim,

remember_for is for automatic login. If you log out it doesn't apply. Having the credentials auto fill in the fields after a logout is handled by the browser. Here is a link to the code that uses it: https://github.com/plataformatec/devise/blob/master/lib/devise/models/rememberable.rb

The comment block has instructions on how the setting is used.

# Rememberable manages generating and clearing token for remember the user
    # from a saved cookie. Rememberable also has utility methods for dealing
    # with serializing the user into the cookie and back from the cookie, trying
    # to lookup the record based on the saved information.
    # You probably wouldn't use rememberable methods directly, they are used
    # mostly internally for handling the remember token.
    #
    # == Options
    #
    # Rememberable adds the following options in devise_for:
    #
    # * +remember_for+: the time you want the user will be remembered without
    # asking for credentials. After this time the user will be blocked and
    # will have to enter his credentials again. This configuration is also
    # used to calculate the expires time for the cookie created to remember
    # the user. By default remember_for is 2.weeks.

 If you set this option it should remember you between browser closes. Again for your id and password to be auto filled in the field between logouts, which are different than browser closes or navigating away from the page, that is handled by the browser. 

I hope this helps.

Thanks,
Bryan

Fahim Patel

unread,
Jul 31, 2013, 1:23:29 AM7/31/13
to rubyonra...@googlegroups.com
Thanks lot  bacrossland  for your input.


On Tuesday, July 30, 2013 1:18:16 PM UTC+5:30, Fahim Patel wrote:

Fahim Patel

unread,
Jul 31, 2013, 1:25:12 AM7/31/13
to rubyonra...@googlegroups.com
It means remember me is working 
I am confusing between remember me and save password prompt which come after successful sign in.
Question's
  1. Did Save password prompt which come after successful sign in is default feature of browser or is effect of rememberable feature ?
  2. How does remember me work than ?

Thanks

bacrossland

unread,
Jul 31, 2013, 10:05:08 AM7/31/13
to rubyonra...@googlegroups.com
Questions

  1. Did Save password prompt which come after successful sign in is default feature of browser or is effect of rememberable feature ?
  2. How does remember me work than ?
Answers
 
1. It is default feature of the browser. The browser will ask you if you want your password remembered for this site. If you click yes then it will store the site URL, login ID and password into a keychain file. That keychain file will be used to auto populate the login fields the next time you come navigate to the page and are presented with the login prompt.

2. Remember me stores your authentication token as a cookie on your system. As long as you don't click logout, clear your cookies, or have not exceeded the time that the cookie will be stored each time authentication is prompted, for instance if your session times out, then you will be auto logged back in. Its function is more like "keep me logged in". 

Fahim Patel

unread,
Jul 31, 2013, 11:32:57 AM7/31/13
to rubyonra...@googlegroups.com
Thanks lot bacrossland .

Best Regards
Fahim


Answers
 
1. It is default feature of the browser. The browser will ask you if you want your password remembered for this site. If you click yes then it will store the site URL, login ID and password into a keychain file. That keychain file will be used to auto populate the login fields the next time you come navigate to the page and are presented with the login prompt.

2. Remember me stores your authentication token as a cookie on your system. As long as you don't click logout, clear your cookies, or have not exceeded the time that the cookie will be stored each time authentication is prompted, for instance if your session times out, then you will be auto logged back in. Its function is more like "keep me logged in". 

On Tuesday, July 30, 2013 1:18:16 PM UTC+5:30, Fahim Patel wrote:

bacrossland

unread,
Aug 1, 2013, 6:43:02 AM8/1/13
to rubyonra...@googlegroups.com
On Wednesday, July 31, 2013 10:32:57 AM UTC-5, Fahim Patel wrote:
Thanks lot bacrossland .

Best Regards
Fahim



You're welcome. 
Reply all
Reply to author
Forward
0 new messages