Concurrent sign in

Korab Hoxha edited this page Jul 25, 2015 · 2 revisions

Clearance allows the same user to be signed in on multiple machines at the same time. When a user signs out on one machine, they will be signed out on all machines.

If you want to override this functionality so that a user can only be signed in on one machine at a time, you can override the sign_in method in your ApplicationController like this:

class ApplicationController < ActionController::Base
  include Clearance::Controller

  def sign_in(user)
    user.reset_remember_token! if user

This will regenerate a new remember_token upon every sign in — giving you the desired behavior of signing out anyone with the same credentials.