设计支持多个并发会话 [英] Devise support for multiple concurrent sessions

查看:208
本文介绍了设计支持多个并发会话的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用Rails 3.2.11与Devise 2.2.3作为订阅服务应用程序。我继承了另一位不再可用的开发人员的应用程序。我很喜欢Rails和Devise。

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.

我想要允许单个用户(电子邮件)拥有多个会话到同一个应用,同时运行。这些会话可能都具有相同的IP地址或不同的IP地址,尽管可能是不同的设备 - 桌面,笔记本电脑,桌子,智能手机。

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?

当我查看User模型时,我看到current_sign_in_at,current_sign_in_ip和authentication_token的单个属性 - - 这让我认为一个用户一次只能有一个会话。

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.

推荐答案

是的,devise允许默认情况下为同一用户多个并发会话。那么,如果你想限制这个行为,你需要使用一些扩展,如: devise_security_extension

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

我使用的是Rails 3.2.17与Devise 3.2.2

I'm using Rails 3.2.17 with Devise 3.2.2

这篇关于设计支持多个并发会话的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆