lib/sorcery/model/adapters/mongoid.rb in sorcery-0.7.6 vs lib/sorcery/model/adapters/mongoid.rb in sorcery-0.7.7
- old
+ new
@@ -70,11 +70,11 @@
end
def get_current_users
config = sorcery_config
where(config.last_activity_at_attribute_name.ne => nil) \
- .any_of({config.last_logout_at_attribute_name => nil},{config.last_activity_at_attribute_name.gt => config.last_logout_at_attribute_name}) \
- .and(config.last_activity_at_attribute_name.gt => config.activity_timeout.seconds.ago.utc.to_s(:db)).order_by([:_id,:asc])
+ .and("this.#{config.last_logout_at_attribute_name} == null || this.#{config.last_activity_at_attribute_name} > this.#{config.last_logout_at_attribute_name}") \
+ .and(config.last_activity_at_attribute_name.gt => config.activity_timeout.seconds.ago.utc).order_by([:_id,:asc])
end
end
end
end
end