Devise support for multiple concurrent sessions

余生长醉 提交于 2020-01-15 03:53:05

问题


I'm using Rails 3.2.11 with Devise 2.2.3 for a subscription service application. I inherited the app from another developer who is no longer available. I am new to Rails and Devise.

I want to allow a single user (email) to have more than one session to the same app, running concurrently. The sessions may all have the same IP address or different IP addresses, though probably different devices -- desktop, laptop, table, smart phone.

I want to treat each session independently, so the user can sign on and off one session without affecting any work in progress on another session.

Question: Does devise support multiple concurrent sessions normally? Do I have to customize any code or config?

When I look at the User model, I see single attributes for "current_sign_in_at", "current_sign_in_ip" and "authentication_token" -- this makes me think a single User can only have one session at a time.

I've looked at this discussion and at the devise wiki but haven't found an answer.


回答1:


Yes, devise allows multiple concurrent sessions for same users by default. Then, if you want restrict this behavior, you need to use some extension like: devise_security_extension

I'm using Rails 3.2.17 with Devise 3.2.2



来源:https://stackoverflow.com/questions/22209932/devise-support-for-multiple-concurrent-sessions

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!