Sha256: d2f2f2f2ab031dba1b1230e8864d2878e1f34ba081dbcfe85dcca0f7c2ef4d7e

Contents?: true

Size: 488 Bytes

Versions: 3

Compression:

Stored size: 488 Bytes

Contents

Warden::Manager.after_set_user except: :fetch do |user, auth, opts|
  request = ActionDispatch::Request.new(auth.env)
  visit_token = request.cookies["ahoy_visit"] || request.headers["Ahoy-Visit"]
  visit = nil
  if visit_token
    visit = Ahoy.visit_model.where(visit_token: visit_token).first
    if visit and !visit.user
      visit.user = user
      visit.save!
    end
  end
  ahoy = Ahoy::Tracker.new(request: request)
  ahoy.track "$authenticate", {}, user: user, visit: visit
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
ahoy_matey-0.3.2 lib/ahoy/warden.rb
ahoy_matey-0.3.1 lib/ahoy/warden.rb
ahoy_matey-0.3.0 lib/ahoy/warden.rb