Authlogic and multiple sessions for the same user

I am using Authlogic for session management in my application.
However, by default authlogic allows the user to log in many times from different computers.
I do not want this (the user pays to gain access, and I want users not to share their accounts).

In the Authlogic documentation, I found about perishable_token . But, trying to implement it, I just get an error when persistence_token is required (when it should not be the way I use perishable).

How do you do this using Authlogic functions?

Thanks:)

+7
authentication ruby ruby-on-rails authlogic
source share
1 answer

Ok, so the perishable token was an absolutely wrong way;)

We just need to reset the persistence token every time a user logs in or logs out. In this case, in my UserSession model, each user logs out of any other session at the login.

 class UserSession < Authlogic::Session::Base before_destroy :reset_persistence_token before_create :reset_persistence_token def reset_persistence_token record.reset_persistence_token end end 
+16
source share

All Articles