0

In ruby on rails with devise how could one check if a user is logged-in 1 time? Its possible to login with multiple browser with the same account.

I need every user to be able to login only 1time, is this possible somehow?

Rubytastic
  • 15,001
  • 18
  • 87
  • 175

1 Answers1

2

As answered here there is a devise plugin for this.

It has an issue with recent versions of devise, but still, there are forks dealing with issue.

Community
  • 1
  • 1
Alper Karapınar
  • 2,694
  • 1
  • 25
  • 36
  • Ok there is an extension available but I just want this one feature so I look for method to code it in myself not using another extension that breaks on updates. – Rubytastic Jul 04 '12 at 21:43
  • You can check source code of the extension. It's based on giving a unique ID for each session and that sounds ok to me. But, i will agree that the security extension is somehow outdated and the unique session problem is a little more complicated then its covered in extension (like where to redirect on multiple login attempts, how to show a warning etc). – Alper Karapınar Jul 05 '12 at 09:16
  • I fixed it with a before filter checking the session token and if its not the same then logout the user overruling the devise session controller – Rubytastic Jul 05 '12 at 11:45