Ruby on Rails Tuesday, July 30, 2013



On Tuesday, July 30, 2013 2:48:16 AM UTC-5, Fahim Patel wrote:

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


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

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/f918e5f4-e63b-4ae7-9b90-75d463fccd34%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

No comments:

Post a Comment