简体   繁体   中英

Rails Session id

I have given the following command in my environment.rb

ActionController::CgiRequest::DEFAULT_SESSION_OPTIONS[:session_key] = 'sessionname'

I want my application to expire to some dynamic value which i get from user. Once the session time which user gives me lapses, i want to remove all the cookies. I could expire all cookies other than the one above ie sessionname

This holds the session id and this is the main cookie i want to expire. Could some one suggest a solution?

it's not good idea to expire session key as it will disrupt users from working with your application

i'd suggest you to have a separate permanent_session_id in cookies which you generate manually upon login and store with expiration time. then use that cookie to log users in if session does not exist.

such approach will allow users to stay logged in while using application and be logged out automatically if permanent_cookie_id is expired after restarting session.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM