Remember me (Devise) not working for me.

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

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

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.

Thanks lot bacrossland for your input.

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

Best Regards

Fahim Babar Patel

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”.

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”.

You’re welcome.