我们如何知道用户是否已经从其他地方登录过他的帐户? [英] How we will know if a user is already logged in to his account from some other place?

查看:112
本文介绍了我们如何知道用户是否已经从其他地方登录过他的帐户?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Hello Friends,



我们如何知道用户是否已从其他地方登录过他的帐户?



谢谢

Hello Friends,

How we will know if a user is already logged in to his account from some other place?

Thanks

推荐答案

在实践中,您可能无法做到:您所能做的只是限制用户登录两次。

问题在于另一个地方对任何人都没有帮助:单个公司中的所有用户都可能共享相同的IP地址,因此如果您的用户登录底层然后接受电梯到34号他会得到相同的IP地址。



你可以通过记录上次登录/使用时间,检查他是否已经明确注销,或者是一个比在允许另一次登录之前,会话持续时间已经过去了。但实际上,这与您的限制有关 - 您不能依赖用户注销,因为情况可以防止这种情况,例如断电或设备故障,因此您必须提供超时期限让他们再次登录。
In practice, you probably can't: all you can do is restrict a user from logging in twice.
The problem is that "another place" doesn't help anyone: all the users in a single company are likely to "share" the same IP address so if your user logs in on the ground floor and then takes the elevator to the 34th he will get the same IP address as far as you are concerned.

You can "prevent" double log in, by recording the last login / use time, and checking if he has explicitly logged out, or a period slightly longer than the Session duration has passed before allowing another log in. But really, that's about your limit - you can't rely on users to log out because circumstances can prevent that, such as a power cut or equipment failure so you have to provide a timeout period to let them login again.


你无法知道这个



http://forums.asp.net/post/5825784.aspx [ ^ ]
You can't know this

http://forums.asp.net/post/5825784.aspx[^]


您必须在应用程序中构建逻辑来处理这种情况。



最简单的解决方案是跟踪数据库中的每次登录(包括时间)。

如果用户从任何其他位置登录,请检查此表并显示我ssage。



一段时间后你需要一个清理工作来清空这张桌子。
You have to build logic in your application to handle this scenario.

Simplest solution is track each login (with the time) in a database.
If the user logins from any other location check this table and display a message.

You will need a clean up job to empty this table after some time.


这篇关于我们如何知道用户是否已经从其他地方登录过他的帐户?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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