spree_auth_devise 3.5.1 → 3.5.2
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of spree_auth_devise might be problematic. Click here for more details.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 45307062e764620c14c90a2e46698079e68fcc2cf4a275c9b68b4dd7c440e235
|
4
|
+
data.tar.gz: 51a0e596192d24d194635e319ae70894d3d7ff9dcb098c7783c0b70f865f3a53
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0467202177d333b27390f4f6fd025e54d8600dfa514419a93d8f9d836740928d7226f8f89a841c215cd5b7e7a83e266bd04f06af4bddd0e961c4faf12d7d944e
|
7
|
+
data.tar.gz: 9d362bd0a46360b6907526dfb50c193b2399551bcd64e7804a65521cc893fc50e49adaf01a7ac981530677dfab3db5345ae65a8f48eb835bd82d6a54378f9327
|
@@ -1,18 +1,14 @@
|
|
1
1
|
# Merges users orders to their account after sign in and sign up.
|
2
2
|
Warden::Manager.after_set_user except: :fetch do |user, auth, _opts|
|
3
|
-
|
4
|
-
|
3
|
+
token = auth.cookies.signed[:guest_token] || auth.cookies.signed[:token]
|
4
|
+
token_attr = Spree::Order.has_attribute?(:token) ? :token : :guest_token
|
5
5
|
|
6
6
|
if token.present? && user.is_a?(Spree::User)
|
7
|
-
Spree::Order.incomplete.where(
|
8
|
-
order.associate_user!(user)
|
9
|
-
end
|
10
|
-
elsif guest_token.present? && user.is_a?(Spree::User)
|
11
|
-
Spree::Order.incomplete.where(guest_token: guest_token, user_id: nil).each do |order|
|
7
|
+
Spree::Order.incomplete.where(token_attr => token, user_id: nil).each do |order|
|
12
8
|
order.associate_user!(user)
|
13
9
|
end
|
14
10
|
end
|
15
|
-
end
|
11
|
+
end
|
16
12
|
|
17
13
|
Warden::Manager.before_logout do |_user, auth, _opts|
|
18
14
|
auth.cookies.delete(:guest_token)
|
@@ -106,6 +106,26 @@ RSpec.describe Spree::UserSessionsController, type: :controller do
|
|
106
106
|
end
|
107
107
|
end
|
108
108
|
|
109
|
+
context 'with a guest_token from a pre-3.7 version of Spree present' do
|
110
|
+
before do
|
111
|
+
request.cookie_jar.signed[:guest_token] = 'ABC'
|
112
|
+
request.cookie_jar.signed[:token] = 'DEF'
|
113
|
+
end
|
114
|
+
|
115
|
+
it 'assigns the correct token attribute for the order' do
|
116
|
+
if Spree.version.to_f > 3.6
|
117
|
+
order = create(:order, email: user.email, token: 'ABC', user_id: nil, created_by_id: nil)
|
118
|
+
else
|
119
|
+
order = create(:order, email: user.email, guest_token: 'ABC', user_id: nil, created_by_id: nil)
|
120
|
+
end
|
121
|
+
spree_post :create, spree_user: { email: user.email, password: 'secret' }
|
122
|
+
|
123
|
+
order.reload
|
124
|
+
expect(order.user_id).to eq user.id
|
125
|
+
expect(order.created_by_id).to eq user.id
|
126
|
+
end
|
127
|
+
end
|
128
|
+
|
109
129
|
context "and html format is used" do
|
110
130
|
it "redirects to default after signing in" do
|
111
131
|
spree_post :create, spree_user: { email: user.email, password: 'secret' }
|
data/spree_auth_devise.gemspec
CHANGED
@@ -3,7 +3,7 @@
|
|
3
3
|
Gem::Specification.new do |s|
|
4
4
|
s.platform = Gem::Platform::RUBY
|
5
5
|
s.name = 'spree_auth_devise'
|
6
|
-
s.version = '3.5.
|
6
|
+
s.version = '3.5.2'
|
7
7
|
s.summary = 'Provides authentication and authorization services for use with Spree by using Devise and CanCan.'
|
8
8
|
s.description = s.summary
|
9
9
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: spree_auth_devise
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.5.
|
4
|
+
version: 3.5.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sean Schofield
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-
|
11
|
+
date: 2019-07-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: devise
|