Sha256: 4f9be00639438e6ae420c2472ba6b267fba75692b38ed1a7a41dbe3d326f24d4
Contents?: true
Size: 491 Bytes
Versions: 3
Compression:
Stored size: 491 Bytes
Contents
# Merges users orders to their account after sign in and sign up. Warden::Manager.after_set_user except: :fetch do |user, auth, opts| if auth.cookies.signed[:guest_token].present? if user.is_a?(Spree::User) Spree::Order.where(email: user.email, guest_token: auth.cookies.signed[:guest_token], user_id: nil).each do |order| order.associate_user!(user) end end end end Warden::Manager.before_logout do |user, auth, opts| auth.cookies.delete :guest_token end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
spree_auth_devise-3.1.0 | config/initializers/warden.rb |
spree_auth_devise-3.0.6 | config/initializers/warden.rb |
spree_auth_devise-3.0.5 | config/initializers/warden.rb |