spree_auth_devise 4.3.4 → 4.4.0
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 +4 -4
- data/.github/dependabot.yml +11 -0
- data/.travis.yml +1 -11
- data/Gemfile +5 -2
- data/README.md +1 -1
- data/app/mailers/spree/user_mailer.rb +3 -3
- data/db/migrate/20210728103922_change_type_of_ship_address_id_and_bill_address_id_for_spree_users.rb +8 -0
- data/lib/controllers/backend/spree/admin/user_sessions_controller.rb +1 -1
- data/{app/controllers → lib/controllers/frontend}/spree/user_confirmations_controller.rb +0 -0
- data/{app/controllers → lib/controllers/frontend}/spree/user_passwords_controller.rb +0 -0
- data/{app/controllers → lib/controllers/frontend}/spree/user_registrations_controller.rb +0 -0
- data/{app/controllers → lib/controllers/frontend}/spree/user_sessions_controller.rb +1 -1
- data/lib/controllers/frontend/spree/users_controller.rb +1 -1
- data/lib/spree/auth/version.rb +1 -1
- data/lib/spree/testing_support/auth_helpers.rb +1 -1
- data/{app/views → lib/views/frontend}/spree/user_passwords/edit.html.erb +0 -0
- data/{app/views → lib/views/frontend}/spree/user_passwords/new.html.erb +0 -0
- data/{app/views → lib/views/frontend}/spree/user_registrations/new.html.erb +0 -0
- data/{app/views → lib/views/frontend}/spree/user_sessions/new.html.erb +0 -0
- data/spec/features/admin/orders_spec.rb +2 -1
- data/spec/features/admin/sign_in_spec.rb +1 -1
- data/spec/features/sign_in_spec.rb +1 -1
- data/spec/models/user_spec.rb +27 -0
- data/spec/support/confirm_helpers.rb +1 -0
- data/spree_auth_devise.gemspec +1 -1
- metadata +16 -26
- data/Appraisals +0 -9
- data/app/services/spree/account/create.rb +0 -19
- data/app/services/spree/account/update.rb +0 -17
- data/gemfiles/spree_4_1.gemfile +0 -8
- data/gemfiles/spree_master.gemfile +0 -8
- data/lib/controllers/api/spree/api/v2/storefront/account_controller_decorator.rb +0 -41
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: dce7d97d09c213c428ce6ce21c81a2156cfa2dfd0e7373effda3980a6e4730dc
|
4
|
+
data.tar.gz: c5ab728a3019fe0117c9c6b0fb62d962092cb019ff81e861258daa0c26927537
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bce33276ffcce416fb378d8c9e3fdae88efeec6166520e97304b8520263a667f2714d46ff724eacf004c34defbb876517979482824bd18e2ef2667c3b56f83b9
|
7
|
+
data.tar.gz: fd9b8eb25d08f6e98939d66a0a9b432452404a5d1ebf21572552ec611bfd11241cde424a910a02373f935cd8cdabd2259783f3c63019209fde2b0daafaafce21
|
data/.travis.yml
CHANGED
@@ -11,6 +11,7 @@ addons:
|
|
11
11
|
services:
|
12
12
|
- mysql
|
13
13
|
- postgresql
|
14
|
+
- redis-server
|
14
15
|
|
15
16
|
language: ruby
|
16
17
|
|
@@ -22,17 +23,6 @@ env:
|
|
22
23
|
- DB=mysql
|
23
24
|
- DB=postgres
|
24
25
|
|
25
|
-
gemfile:
|
26
|
-
- gemfiles/spree_4_1.gemfile
|
27
|
-
- gemfiles/spree_master.gemfile
|
28
|
-
|
29
|
-
jobs:
|
30
|
-
exclude:
|
31
|
-
- rvm: 3.0
|
32
|
-
gemfile: gemfiles/spree_4_1.gemfile
|
33
|
-
allow_failures:
|
34
|
-
- gemfile: gemfiles/spree_master.gemfile
|
35
|
-
|
36
26
|
before_install:
|
37
27
|
- mysql -u root -e "GRANT ALL ON *.* TO 'travis'@'%';"
|
38
28
|
|
data/Gemfile
CHANGED
@@ -1,7 +1,10 @@
|
|
1
1
|
source 'https://rubygems.org'
|
2
2
|
|
3
3
|
gem 'rails-controller-testing'
|
4
|
-
gem 'spree', github: 'spree/spree', branch: '
|
4
|
+
gem 'spree', github: 'spree/spree', branch: 'main'
|
5
|
+
gem 'spree_backend', github: 'spree/spree', branch: 'main'
|
6
|
+
gem 'spree_frontend', github: 'spree/spree', branch: 'main'
|
7
|
+
gem 'spree_emails', github: 'spree/spree', branch: 'main'
|
5
8
|
|
6
|
-
gem 'pry', '~> 0.
|
9
|
+
gem 'pry', '~> 0.14.1'
|
7
10
|
gemspec
|
data/README.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# Spree Auth (Devise)
|
2
2
|
|
3
|
-
[![Build Status](https://travis-ci.
|
3
|
+
[![Build Status](https://travis-ci.com/spree/spree_auth_devise.svg?branch=main)](https://travis-ci.org/spree/spree_auth_devise)
|
4
4
|
[![Code Climate](https://codeclimate.com/github/spree/spree_auth_devise/badges/gpa.svg)](https://codeclimate.com/github/spree/spree_auth_devise)
|
5
5
|
|
6
6
|
Provides authentication services for [Spree](https://spreecommerce.org), using the [Devise](https://github.com/plataformatec/devise) gem.
|
@@ -1,5 +1,5 @@
|
|
1
1
|
module Spree
|
2
|
-
class UserMailer < BaseMailer
|
2
|
+
class UserMailer < defined?(Spree::BaseMailer) ? Spree::BaseMailer : ActionMailer::Base
|
3
3
|
def reset_password_instructions(user, token, *_args)
|
4
4
|
current_store_id = _args.inject(:merge)[:current_store_id]
|
5
5
|
@current_store = Spree::Store.find(current_store_id) || Spree::Store.current
|
@@ -8,7 +8,7 @@ module Spree
|
|
8
8
|
@edit_password_reset_url = spree.edit_spree_user_password_url(reset_password_token: token, host: @current_store.url)
|
9
9
|
@user = user
|
10
10
|
|
11
|
-
mail to: user.email, from:
|
11
|
+
mail to: user.email, from: @current_store.mail_from_address, subject: @current_store.name + ' ' + I18n.t(:subject, scope: [:devise, :mailer, :reset_password_instructions]), store_url: @current_store.url
|
12
12
|
end
|
13
13
|
|
14
14
|
def confirmation_instructions(user, token, _opts = {})
|
@@ -17,7 +17,7 @@ module Spree
|
|
17
17
|
@confirmation_url = spree.confirmation_url(confirmation_token: token, host: Spree::Store.current.url)
|
18
18
|
@email = user.email
|
19
19
|
|
20
|
-
mail to: user.email, from:
|
20
|
+
mail to: user.email, from: @current_store.mail_from_address, subject: @current_store.name + ' ' + I18n.t(:subject, scope: [:devise, :mailer, :confirmation_instructions]), store_url: @current_store.url
|
21
21
|
end
|
22
22
|
end
|
23
23
|
end
|
@@ -14,7 +14,7 @@ class Spree::Admin::UserSessionsController < Devise::SessionsController
|
|
14
14
|
if spree_user_signed_in?
|
15
15
|
respond_to do |format|
|
16
16
|
format.html {
|
17
|
-
flash[:success] = Spree.t(:
|
17
|
+
flash[:success] = Spree.t(:logged_in_successfully)
|
18
18
|
redirect_back_or_default(after_sign_in_path_for(spree_current_user))
|
19
19
|
}
|
20
20
|
format.js {
|
File without changes
|
File without changes
|
File without changes
|
@@ -25,7 +25,7 @@ class Spree::UserSessionsController < Devise::SessionsController
|
|
25
25
|
if spree_user_signed_in?
|
26
26
|
respond_to do |format|
|
27
27
|
format.html {
|
28
|
-
flash[:success] = Spree.t(:
|
28
|
+
flash[:success] = Spree.t(:logged_in_successfully)
|
29
29
|
redirect_back_or_default(after_sign_in_redirect(spree_current_user))
|
30
30
|
}
|
31
31
|
format.js {
|
@@ -6,7 +6,7 @@ class Spree::UsersController < Spree::StoreController
|
|
6
6
|
include Spree::Core::ControllerHelpers
|
7
7
|
|
8
8
|
def show
|
9
|
-
@orders = @user.orders.complete.order('completed_at desc')
|
9
|
+
@orders = @user.orders.for_store(current_store).complete.order('completed_at desc')
|
10
10
|
end
|
11
11
|
|
12
12
|
def create
|
data/lib/spree/auth/version.rb
CHANGED
@@ -19,7 +19,7 @@ module Spree
|
|
19
19
|
first('label', text: Spree.t(:remember_me)).click if remember_me
|
20
20
|
click_button login_button
|
21
21
|
|
22
|
-
expect(page).to have_content Spree.t(:
|
22
|
+
expect(page).to have_content Spree.t(:logged_in_successfully)
|
23
23
|
end
|
24
24
|
|
25
25
|
def log_out
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
@@ -16,7 +16,8 @@ RSpec.feature 'Admin orders', type: :feature do
|
|
16
16
|
|
17
17
|
# Regression #203
|
18
18
|
scenario 'can not edit orders' do
|
19
|
-
|
19
|
+
visit spree.edit_admin_order_path('nodata')
|
20
|
+
expect(page).to have_text('Order is not found')
|
20
21
|
end
|
21
22
|
|
22
23
|
# Regression #203
|
data/spec/models/user_spec.rb
CHANGED
@@ -27,6 +27,33 @@ RSpec.describe Spree::User, type: :model do
|
|
27
27
|
end
|
28
28
|
end
|
29
29
|
|
30
|
+
describe 'validations' do
|
31
|
+
context 'email' do
|
32
|
+
let(:user) { build(:user, email: nil) }
|
33
|
+
|
34
|
+
it 'cannot be empty' do
|
35
|
+
expect(user.valid?).to be false
|
36
|
+
expect(user.errors.messages[:email].first).to eq "can't be blank"
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
context 'password' do
|
41
|
+
let(:user) { build(:user, password_confirmation: nil) }
|
42
|
+
|
43
|
+
it 'password confirmation cannot be empty' do
|
44
|
+
expect(user.valid?).to be false
|
45
|
+
expect(user.errors.messages[:password_confirmation].first).to eq "doesn't match Password"
|
46
|
+
end
|
47
|
+
|
48
|
+
let(:user) { build(:user, password: 'pass1234', password_confirmation: 'pass') }
|
49
|
+
|
50
|
+
it 'passwords has to be equal to password confirmation' do
|
51
|
+
expect(user.valid?).to be false
|
52
|
+
expect(user.errors.messages[:password_confirmation].first).to eq "doesn't match Password"
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|
30
57
|
context '#destroy' do
|
31
58
|
it 'will soft delete with uncompleted orders' do
|
32
59
|
order = build(:order)
|
data/spree_auth_devise.gemspec
CHANGED
@@ -33,7 +33,7 @@ Gem::Specification.new do |s|
|
|
33
33
|
s.add_dependency 'devise', '~> 4.7'
|
34
34
|
s.add_dependency 'devise-encryptable', '0.2.0'
|
35
35
|
|
36
|
-
spree_version = '>= 4.
|
36
|
+
spree_version = '>= 4.3.0.rc1'
|
37
37
|
s.add_dependency 'spree_core', spree_version
|
38
38
|
s.add_dependency 'spree_extension'
|
39
39
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: spree_auth_devise
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 4.
|
4
|
+
version: 4.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sean Schofield
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2021-
|
12
|
+
date: 2021-09-14 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: devise
|
@@ -45,20 +45,14 @@ dependencies:
|
|
45
45
|
requirements:
|
46
46
|
- - ">="
|
47
47
|
- !ruby/object:Gem::Version
|
48
|
-
version:
|
49
|
-
- - "<"
|
50
|
-
- !ruby/object:Gem::Version
|
51
|
-
version: '5.0'
|
48
|
+
version: 4.3.0.rc1
|
52
49
|
type: :runtime
|
53
50
|
prerelease: false
|
54
51
|
version_requirements: !ruby/object:Gem::Requirement
|
55
52
|
requirements:
|
56
53
|
- - ">="
|
57
54
|
- !ruby/object:Gem::Version
|
58
|
-
version:
|
59
|
-
- - "<"
|
60
|
-
- !ruby/object:Gem::Version
|
61
|
-
version: '5.0'
|
55
|
+
version: 4.3.0.rc1
|
62
56
|
- !ruby/object:Gem::Dependency
|
63
57
|
name: spree_extension
|
64
58
|
requirement: !ruby/object:Gem::Requirement
|
@@ -96,10 +90,10 @@ extra_rdoc_files: []
|
|
96
90
|
files:
|
97
91
|
- ".circleci/config.yml"
|
98
92
|
- ".gem_release.yml"
|
93
|
+
- ".github/dependabot.yml"
|
99
94
|
- ".gitignore"
|
100
95
|
- ".rspec"
|
101
96
|
- ".travis.yml"
|
102
|
-
- Appraisals
|
103
97
|
- CHANGELOG.md
|
104
98
|
- Gemfile
|
105
99
|
- LICENSE.md
|
@@ -108,23 +102,13 @@ files:
|
|
108
102
|
- app/controllers/metal_decorator.rb
|
109
103
|
- app/controllers/spree/api/v2/storefront/account_confirmations_controller.rb
|
110
104
|
- app/controllers/spree/api/v2/storefront/passwords_controller.rb
|
111
|
-
- app/controllers/spree/user_confirmations_controller.rb
|
112
|
-
- app/controllers/spree/user_passwords_controller.rb
|
113
|
-
- app/controllers/spree/user_registrations_controller.rb
|
114
|
-
- app/controllers/spree/user_sessions_controller.rb
|
115
105
|
- app/mailers/spree/user_mailer.rb
|
116
106
|
- app/models/spree/auth_configuration.rb
|
117
107
|
- app/models/spree/user.rb
|
118
|
-
- app/services/spree/account/create.rb
|
119
|
-
- app/services/spree/account/update.rb
|
120
108
|
- app/views/spree/user_mailer/confirmation_instructions.html.erb
|
121
109
|
- app/views/spree/user_mailer/confirmation_instructions.text.erb
|
122
110
|
- app/views/spree/user_mailer/reset_password_instructions.html.erb
|
123
111
|
- app/views/spree/user_mailer/reset_password_instructions.text.erb
|
124
|
-
- app/views/spree/user_passwords/edit.html.erb
|
125
|
-
- app/views/spree/user_passwords/new.html.erb
|
126
|
-
- app/views/spree/user_registrations/new.html.erb
|
127
|
-
- app/views/spree/user_sessions/new.html.erb
|
128
112
|
- bin/rails
|
129
113
|
- config.ru
|
130
114
|
- config/initializers/devise.rb
|
@@ -150,10 +134,8 @@ files:
|
|
150
134
|
- db/migrate/20140904000425_add_deleted_at_to_users.rb
|
151
135
|
- db/migrate/20141002154641_add_confirmable_to_users.rb
|
152
136
|
- db/migrate/20150416152553_add_missing_indices_on_user.rb
|
137
|
+
- db/migrate/20210728103922_change_type_of_ship_address_id_and_bill_address_id_for_spree_users.rb
|
153
138
|
- db/seeds.rb
|
154
|
-
- gemfiles/spree_4_1.gemfile
|
155
|
-
- gemfiles/spree_master.gemfile
|
156
|
-
- lib/controllers/api/spree/api/v2/storefront/account_controller_decorator.rb
|
157
139
|
- lib/controllers/backend/spree/admin/base_controller_decorator.rb
|
158
140
|
- lib/controllers/backend/spree/admin/orders/customer_details_controller_decorator.rb
|
159
141
|
- lib/controllers/backend/spree/admin/orders_controller_decorator.rb
|
@@ -161,6 +143,10 @@ files:
|
|
161
143
|
- lib/controllers/backend/spree/admin/user_passwords_controller.rb
|
162
144
|
- lib/controllers/backend/spree/admin/user_sessions_controller.rb
|
163
145
|
- lib/controllers/frontend/spree/checkout_controller_decorator.rb
|
146
|
+
- lib/controllers/frontend/spree/user_confirmations_controller.rb
|
147
|
+
- lib/controllers/frontend/spree/user_passwords_controller.rb
|
148
|
+
- lib/controllers/frontend/spree/user_registrations_controller.rb
|
149
|
+
- lib/controllers/frontend/spree/user_sessions_controller.rb
|
164
150
|
- lib/controllers/frontend/spree/users_controller.rb
|
165
151
|
- lib/generators/spree/auth/install/install_generator.rb
|
166
152
|
- lib/generators/spree/auth/install/templates/config/initializers/devise.rb
|
@@ -181,6 +167,10 @@ files:
|
|
181
167
|
- lib/views/backend/spree/layouts/login.html.erb
|
182
168
|
- lib/views/frontend/spree/shared/_flashes.html.erb
|
183
169
|
- lib/views/frontend/spree/shared/_login_bar.html.erb
|
170
|
+
- lib/views/frontend/spree/user_passwords/edit.html.erb
|
171
|
+
- lib/views/frontend/spree/user_passwords/new.html.erb
|
172
|
+
- lib/views/frontend/spree/user_registrations/new.html.erb
|
173
|
+
- lib/views/frontend/spree/user_sessions/new.html.erb
|
184
174
|
- spec/controllers/spree/admin/orders_controller_spec.rb
|
185
175
|
- spec/controllers/spree/admin/user_sessions_controller_spec.rb
|
186
176
|
- spec/controllers/spree/api/v2/storefront/passwords_controller_spec.rb
|
@@ -222,9 +212,9 @@ licenses:
|
|
222
212
|
- BSD-3-Clause
|
223
213
|
metadata:
|
224
214
|
bug_tracker_uri: https://github.com/spree/spree_auth_devise/issues
|
225
|
-
changelog_uri: https://github.com/spree/spree_auth_devise/releases/tag/v4.
|
215
|
+
changelog_uri: https://github.com/spree/spree_auth_devise/releases/tag/v4.4.0
|
226
216
|
documentation_uri: https://guides.spreecommerce.org/
|
227
|
-
source_code_uri: https://github.com/spree/spree_auth_devise/tree/v4.
|
217
|
+
source_code_uri: https://github.com/spree/spree_auth_devise/tree/v4.4.0
|
228
218
|
post_install_message:
|
229
219
|
rdoc_options: []
|
230
220
|
require_paths:
|
data/Appraisals
DELETED
@@ -1,19 +0,0 @@
|
|
1
|
-
module Spree
|
2
|
-
module Account
|
3
|
-
class Create
|
4
|
-
prepend Spree::ServiceModule::Base
|
5
|
-
|
6
|
-
def call(user_params: nil)
|
7
|
-
user_params ||= {}
|
8
|
-
|
9
|
-
user = Spree.user_class.new(user_params)
|
10
|
-
|
11
|
-
if user.save
|
12
|
-
success(user)
|
13
|
-
else
|
14
|
-
failure(user)
|
15
|
-
end
|
16
|
-
end
|
17
|
-
end
|
18
|
-
end
|
19
|
-
end
|
@@ -1,17 +0,0 @@
|
|
1
|
-
module Spree
|
2
|
-
module Account
|
3
|
-
class Update
|
4
|
-
prepend Spree::ServiceModule::Base
|
5
|
-
|
6
|
-
def call(user:, user_params: nil)
|
7
|
-
user_params ||= {}
|
8
|
-
|
9
|
-
if user.update(user_params)
|
10
|
-
success(user)
|
11
|
-
else
|
12
|
-
failure(user)
|
13
|
-
end
|
14
|
-
end
|
15
|
-
end
|
16
|
-
end
|
17
|
-
end
|
data/gemfiles/spree_4_1.gemfile
DELETED
@@ -1,41 +0,0 @@
|
|
1
|
-
module Spree
|
2
|
-
module Api
|
3
|
-
module V2
|
4
|
-
module Storefront
|
5
|
-
module AccountControllerDecorator
|
6
|
-
def self.prepended(base)
|
7
|
-
base.skip_before_action :require_spree_current_user, only: [:create]
|
8
|
-
end
|
9
|
-
|
10
|
-
def create
|
11
|
-
result = Spree::Account::Create.call(user_params: spree_user_params)
|
12
|
-
|
13
|
-
render_payload(result)
|
14
|
-
end
|
15
|
-
|
16
|
-
def update
|
17
|
-
result = Spree::Account::Update.call(user: spree_current_user, user_params: spree_user_params)
|
18
|
-
|
19
|
-
render_payload(result)
|
20
|
-
end
|
21
|
-
|
22
|
-
private
|
23
|
-
|
24
|
-
def render_payload(result)
|
25
|
-
if result.success?
|
26
|
-
render_serialized_payload { serialize_resource(result.value) }
|
27
|
-
else
|
28
|
-
render_error_payload(result.error)
|
29
|
-
end
|
30
|
-
end
|
31
|
-
|
32
|
-
def spree_user_params
|
33
|
-
params.require(:user).permit(Spree::PermittedAttributes.user_attributes)
|
34
|
-
end
|
35
|
-
end
|
36
|
-
end
|
37
|
-
end
|
38
|
-
end
|
39
|
-
end
|
40
|
-
|
41
|
-
::Spree::Api::V2::Storefront::AccountController.prepend(Spree::Api::V2::Storefront::AccountControllerDecorator)
|