4

I have used AngularJs and rails in my application . I want to achieve the following , i just want to know if it's possible and if so , then how -

1) User A log in from computer A

2) Someone else logs in using the same username and password into machine B

3) Machine A should automatically log out

Currently i have devise users logging in and out in a normal manner , i do have take in their tokens and last login but i am clueless how would i achieve this .

How can i fix this issue in a standard authenticated session mechanism with tokens . Any advice or suggestions would be much appreciated too . I have searched around on SO without any success .

  • I don't think that can be considered as an answer , that's why i have asked it again hoping to get a better response . –  Nov 26 '14 at 10:47
  • I think it absolutely does. The first answer explains why you should not do that and the second answer provides a possible solution even though. – KARASZI István Nov 26 '14 at 12:01
  • The second solution is only applicable to rails 3 as it won't work with rails 4 . –  Nov 26 '14 at 12:35
  • Your question has been tagged with ruby-on-rails-3, FYI. – KARASZI István Nov 26 '14 at 13:41

1 Answers1

0

You can use database for maintain session token, whenever any user logged in add row to database table with any unique token, now whenever same user logs in from another machine just update the token. and on root of your code, continuously check that existing token in session with database.

Hope it helps :)

Er.KT
  • 2,852
  • 1
  • 36
  • 70