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.

Files changed (32) hide show
  1. checksums.yaml +4 -4
  2. data/.github/dependabot.yml +11 -0
  3. data/.travis.yml +1 -11
  4. data/Gemfile +5 -2
  5. data/README.md +1 -1
  6. data/app/mailers/spree/user_mailer.rb +3 -3
  7. data/db/migrate/20210728103922_change_type_of_ship_address_id_and_bill_address_id_for_spree_users.rb +8 -0
  8. data/lib/controllers/backend/spree/admin/user_sessions_controller.rb +1 -1
  9. data/{app/controllers → lib/controllers/frontend}/spree/user_confirmations_controller.rb +0 -0
  10. data/{app/controllers → lib/controllers/frontend}/spree/user_passwords_controller.rb +0 -0
  11. data/{app/controllers → lib/controllers/frontend}/spree/user_registrations_controller.rb +0 -0
  12. data/{app/controllers → lib/controllers/frontend}/spree/user_sessions_controller.rb +1 -1
  13. data/lib/controllers/frontend/spree/users_controller.rb +1 -1
  14. data/lib/spree/auth/version.rb +1 -1
  15. data/lib/spree/testing_support/auth_helpers.rb +1 -1
  16. data/{app/views → lib/views/frontend}/spree/user_passwords/edit.html.erb +0 -0
  17. data/{app/views → lib/views/frontend}/spree/user_passwords/new.html.erb +0 -0
  18. data/{app/views → lib/views/frontend}/spree/user_registrations/new.html.erb +0 -0
  19. data/{app/views → lib/views/frontend}/spree/user_sessions/new.html.erb +0 -0
  20. data/spec/features/admin/orders_spec.rb +2 -1
  21. data/spec/features/admin/sign_in_spec.rb +1 -1
  22. data/spec/features/sign_in_spec.rb +1 -1
  23. data/spec/models/user_spec.rb +27 -0
  24. data/spec/support/confirm_helpers.rb +1 -0
  25. data/spree_auth_devise.gemspec +1 -1
  26. metadata +16 -26
  27. data/Appraisals +0 -9
  28. data/app/services/spree/account/create.rb +0 -19
  29. data/app/services/spree/account/update.rb +0 -17
  30. data/gemfiles/spree_4_1.gemfile +0 -8
  31. data/gemfiles/spree_master.gemfile +0 -8
  32. 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: 3e12256ddf3e493e918afe0f529f5abf35fe8db54ac04623081c96f82c4b8bb1
4
- data.tar.gz: 898d1757061761ff25aeb56dbc09a8c111d21881051526fd0e842c30a6d264e4
3
+ metadata.gz: dce7d97d09c213c428ce6ce21c81a2156cfa2dfd0e7373effda3980a6e4730dc
4
+ data.tar.gz: c5ab728a3019fe0117c9c6b0fb62d962092cb019ff81e861258daa0c26927537
5
5
  SHA512:
6
- metadata.gz: b54d41d158228c72e3167d8354f1ba352030533885776a3a7c2a30dc675ac2055627bf48c5da724e5104e0004b4f8cfca1504ded6ceaed0e4c632edc9c95cce4
7
- data.tar.gz: dfc8ac967964ee75c706e138c015b627e303798c7bbb88fe4ee63077149717ece0c8474d7888cc6280ea2c0a4fad363ecf1f1f4516f47ef80fe93c0abbf8cfe5
6
+ metadata.gz: bce33276ffcce416fb378d8c9e3fdae88efeec6166520e97304b8520263a667f2714d46ff724eacf004c34defbb876517979482824bd18e2ef2667c3b56f83b9
7
+ data.tar.gz: fd9b8eb25d08f6e98939d66a0a9b432452404a5d1ebf21572552ec611bfd11241cde424a910a02373f935cd8cdabd2259783f3c63019209fde2b0daafaafce21
@@ -0,0 +1,11 @@
1
+ version: 2
2
+ updates:
3
+ - package-ecosystem: bundler
4
+ directory: "/"
5
+ schedule:
6
+ interval: daily
7
+ open-pull-requests-limit: 10
8
+ ignore:
9
+ - dependency-name: pry
10
+ versions:
11
+ - 0.14.0
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: 'master'
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.13.1'
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.org/spree/spree_auth_devise.svg?branch=master)](https://travis-ci.org/spree/spree_auth_devise)
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: from_address, subject: @current_store.name + ' ' + I18n.t(:subject, scope: [:devise, :mailer, :reset_password_instructions]), store_url: @current_store.url
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: from_address, subject: @current_store.name + ' ' + I18n.t(:subject, scope: [:devise, :mailer, :confirmation_instructions]), store_url: @current_store.url
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
@@ -0,0 +1,8 @@
1
+ class ChangeTypeOfShipAddressIdAndBillAddressIdForSpreeUsers < ActiveRecord::Migration[4.2]
2
+ def change
3
+ change_table(:spree_users) do |t|
4
+ t.change :ship_address_id, :bigint
5
+ t.change :bill_address_id, :bigint
6
+ end
7
+ end
8
+ 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(:logged_in_succesfully)
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 {
@@ -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(:logged_in_succesfully)
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
@@ -1,6 +1,6 @@
1
1
  module Spree
2
2
  module Auth
3
- VERSION = '4.3.4'.freeze
3
+ VERSION = '4.4.0'.freeze
4
4
 
5
5
  def gem_version
6
6
  Gem::Version.new(VERSION)
@@ -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(:logged_in_succesfully)
22
+ expect(page).to have_content Spree.t(:logged_in_successfully)
23
23
  end
24
24
 
25
25
  def log_out
@@ -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
- expect { visit spree.edit_admin_order_path('nodata') }.to raise_error(ActiveRecord::RecordNotFound)
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
@@ -36,7 +36,7 @@ RSpec.feature 'Admin - Sign In', type: :feature do
36
36
  click_button login_button
37
37
 
38
38
  if Spree.version.to_f > 4.1
39
- within '.navbar .dropdown-menu' do
39
+ within '.navbar .dropdown-menu-right' do
40
40
  expect(page).to have_text 'admin@person.com'
41
41
  end
42
42
  else
@@ -36,7 +36,7 @@ RSpec.feature 'Sign In', type: :feature do
36
36
 
37
37
  if Spree.version.to_f > 4.1
38
38
  click_button login_button
39
- within '.navbar .dropdown-menu' do
39
+ within '.navbar .dropdown-menu-right' do
40
40
  expect(page).to have_text 'admin@person.com'
41
41
  end
42
42
  else
@@ -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)
@@ -15,6 +15,7 @@ RSpec.configure do |config|
15
15
 
16
16
  config.before do |example|
17
17
  if example.metadata.key?(:confirmable)
18
+ Rails.cache.clear
18
19
  Spree::Auth::Config[:confirmable] = example.metadata[:confirmable]
19
20
 
20
21
  Spree.send(:remove_const, :User)
@@ -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.1', '< 5.0'
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.3.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-02-24 00:00:00.000000000 Z
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: '4.1'
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: '4.1'
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.3.4
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.3.4
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,9 +0,0 @@
1
- appraise 'spree-4-1' do
2
- gem 'rails-controller-testing'
3
- gem 'spree', '~> 4.1'
4
- end
5
-
6
- appraise 'spree-master' do
7
- gem 'rails-controller-testing'
8
- gem 'spree', github: 'spree/spree', branch: 'master'
9
- end
@@ -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
@@ -1,8 +0,0 @@
1
- # This file was generated by Appraisal
2
-
3
- source "https://rubygems.org"
4
-
5
- gem "rails-controller-testing"
6
- gem "spree", "~> 4.1"
7
-
8
- gemspec path: "../"
@@ -1,8 +0,0 @@
1
- # This file was generated by Appraisal
2
-
3
- source "https://rubygems.org"
4
-
5
- gem "rails-controller-testing"
6
- gem "spree", github: "spree/spree", branch: "master"
7
-
8
- gemspec path: "../"
@@ -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)