Sha256: b3ef2c5615f227415e5260f64b581984c39ffb894b1a99f6f0ebb84cd7863a4c
Contents?: true
Size: 939 Bytes
Versions: 4
Compression:
Stored size: 939 Bytes
Contents
module Sorcery module Model module Adapters module ActiveRecord def self.included(klass) klass.extend ClassMethods end module ClassMethods def find_by_credentials(credentials) where("#{@sorcery_config.username_attribute_name} = ?", credentials[0]).first end def find_by_token(token_attr_name, token) where("#{token_attr_name} = ?", token).first end def get_current_users config = sorcery_config where("#{config.last_activity_at_attribute_name} IS NOT NULL") \ .where("#{config.last_logout_at_attribute_name} IS NULL OR #{config.last_activity_at_attribute_name} > #{config.last_logout_at_attribute_name}") \ .where("#{config.last_activity_at_attribute_name} > ? ", config.activity_timeout.seconds.ago.utc.to_s(:db)) end end end end end end
Version data entries
4 entries across 4 versions & 1 rubygems