I changed the domain setting in the session_store configuration and now previous users cannot log in or register without clearing their cookies.

I have a rails 3.2.8 application that users are developing for users_sessions. Previously, it had a config/initializers/session_store.rb file, which looked like this:

 AppName::Application.config.session_store :active_record_store 

The application started for some time, and users visited the site and registered. Then I changed session_store.rb

to

 AppName::Application.config.session_store :active_record_store, domain: '.app_name.com' 

so that the session is saved in subdomains. The problem I discovered was that users who had previously visited the site and signed up could no longer until they cleared their cookies. How can I allow previous users to log in without requiring them to clear their cookies and allow their session to be stored in subdomains?

+4
source share
1 answer

If you change the name of the session cookie, it will not delete the old cookie, but it will force everyone to get a new one.

 AppName::Application.config.session_store :new_name_store, domain: '.app_name.com' 
+1
source

Source: https://habr.com/ru/post/1448045/


All Articles