solidus_auth_devise 1.1.0 → 1.2.0

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of solidus_auth_devise might be problematic. Click here for more details.

checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: fb97d2596201f6b868061b6064d27ab4ea0df410
4
- data.tar.gz: b05459072856d24460abed0bd7adc90a2d258113
3
+ metadata.gz: b5cf4aa80513d06a54e23702ed88741c43c7382a
4
+ data.tar.gz: 657066204c77305b7e9dbfa8fe00f2d064cb518b
5
5
  SHA512:
6
- metadata.gz: 636e4dd8e7aed3bd4309a8075c5b6831bdcf5063a406290ed8b46079cc31fd5305989b94d5ac5805264bc4147ca09786012cba274a102e45a36c19ad19bd3930
7
- data.tar.gz: d109430fe560ecae80f6172192a0b8181cbcaa5f51770f56f67a6f81f6f024be0a2cf2e1d8d001d970d090a92f09779d79e486cadab4a9ebda6cc7fa9cbea9f5
6
+ metadata.gz: 76a34014abe38b2f73397f0a969719c2d35523252e76e830b550fa6d9935c1615e3157f2df99372ac50930a4980186597dacd11c96ffbbb32031d39e81eceb93
7
+ data.tar.gz: b922becf025a09a3203ec8b79414d39f5daa6f109c866d456bbac32295dc3cc0e6ea0fe0a6708133e64cbe057dcecc20f4754ee7de5f17796e4f6b3b74259c90
@@ -2,6 +2,7 @@ module Spree
2
2
  class User < ActiveRecord::Base
3
3
  include UserAddress
4
4
  include UserPaymentSource
5
+ include UserMethods
5
6
 
6
7
  devise :database_authenticatable, :registerable, :recoverable,
7
8
  :rememberable, :trackable, :validatable, :encryptable, :encryptor => 'authlogic_sha512'
@@ -1,26 +1,11 @@
1
1
  Spree::Admin::BaseController.class_eval do
2
-
3
- # Redirect as appropriate when an access request fails. The default action is to redirect to the login screen.
4
- # Override this method in your controllers if you want to have special behavior in case the user is not authorized
5
- # to access the requested action. For example, a popup window might simply close itself.
6
- def unauthorized
7
- if try_spree_current_user
8
- flash[:error] = Spree.t(:authorization_failure)
9
- redirect_to spree.admin_unauthorized_path
10
- else
11
- store_location
12
- redirect_to spree.admin_login_path
13
- end
14
- end
15
-
16
2
  protected
17
3
 
18
- def model_class
19
- const_name = controller_name.classify
20
- if Spree.const_defined?(const_name, false)
21
- return "Spree::#{const_name}".constantize
22
- end
23
- nil
4
+ def model_class
5
+ const_name = controller_name.classify
6
+ if Spree.const_defined?(const_name, false)
7
+ return "Spree::#{const_name}".constantize
24
8
  end
25
-
9
+ nil
10
+ end
26
11
  end
@@ -1,4 +1,4 @@
1
- module Spree
1
+ module Solidus
2
2
  module Auth
3
3
  module Generators
4
4
  class InstallGenerator < Rails::Generators::Base
@@ -9,8 +9,7 @@ module Spree
9
9
  end
10
10
 
11
11
  def generate_devise_key
12
- return if ENV['TRAVIS']
13
- template 'config/initializers/devise.rb', 'config/initializers/devise.rb'
12
+ template 'config/initializers/devise.rb', 'config/initializers/devise.rb', skip: true
14
13
  end
15
14
 
16
15
  def add_migrations
@@ -44,6 +44,26 @@ module Spree
44
44
  end
45
45
  end
46
46
  ApplicationController.send :include, Spree::AuthenticationHelpers
47
+
48
+ Spree::BaseController.unauthorized_redirect = -> do
49
+ if try_spree_current_user
50
+ flash[:error] = Spree.t(:authorization_failure)
51
+ redirect_to spree.unauthorized_path
52
+ else
53
+ store_location
54
+ redirect_to spree.login_path
55
+ end
56
+ end
57
+
58
+ Spree::Admin::BaseController.unauthorized_redirect = -> do
59
+ if try_spree_current_user
60
+ flash[:error] = Spree.t(:authorization_failure)
61
+ redirect_to spree.admin_unauthorized_path
62
+ else
63
+ store_location
64
+ redirect_to spree.admin_login_path
65
+ end
66
+ end
47
67
  end
48
68
 
49
69
  def self.backend_available?
@@ -3,7 +3,7 @@
3
3
  Gem::Specification.new do |s|
4
4
  s.platform = Gem::Platform::RUBY
5
5
  s.name = "solidus_auth_devise"
6
- s.version = "1.1.0"
6
+ s.version = "1.2.0"
7
7
  s.summary = "Provides authentication and authorization services for use with Solidus by using Devise and CanCan."
8
8
  s.description = s.summary
9
9
 
@@ -18,7 +18,7 @@ Gem::Specification.new do |s|
18
18
  s.require_path = "lib"
19
19
  s.requirements << "none"
20
20
 
21
- solidus_version = [">= 1.0.0.pre", "< 2"]
21
+ solidus_version = [">= 1.0.0.pre2", "< 2"]
22
22
 
23
23
  s.add_dependency "solidus_core", solidus_version
24
24
  s.add_dependency "devise", '~> 3.5.1'
@@ -29,7 +29,7 @@ Gem::Specification.new do |s|
29
29
 
30
30
  s.add_development_dependency "solidus_backend", solidus_version
31
31
  s.add_development_dependency "solidus_frontend", solidus_version
32
- s.add_development_dependency "rspec-rails", "~> 3.0.0"
32
+ s.add_development_dependency "rspec-rails", "~> 3.3"
33
33
  s.add_development_dependency "simplecov", "~> 0.9.0"
34
34
  s.add_development_dependency "sqlite3"
35
35
  s.add_development_dependency "sass-rails", "~> 4.0.0"
@@ -39,6 +39,6 @@ RSpec.feature 'Admin - Sign In', type: :feature do
39
39
  click_button 'Login'
40
40
 
41
41
  expect(page).to have_text 'Logged in as: admin@person.com'
42
- expect(current_path).to eq '/admin/orders'
42
+ expect(current_path).to eq '/admin/dashboards/home'
43
43
  end
44
44
  end
@@ -90,7 +90,6 @@ RSpec.feature 'Checkout', :js, type: :feature do
90
90
 
91
91
  # Regression test for #890
92
92
  scenario 'associate an incomplete guest order with user after successful password reset' do
93
- create(:store)
94
93
  user = create(:user, email: 'email@person.com', password: 'password', password_confirmation: 'password')
95
94
  click_link 'RoR Mug'
96
95
  click_button 'Add To Cart'
@@ -103,7 +102,7 @@ RSpec.feature 'Checkout', :js, type: :feature do
103
102
  # Need to do this now because the token stored in the DB is the encrypted version
104
103
  # The 'plain-text' version is sent in the email and there's one way to get that!
105
104
  reset_password_email = ActionMailer::Base.deliveries.first
106
- token_url_regex = /^http:\/\/www.example.com\/user\/spree_user\/password\/edit\?reset_password_token=(.*)$/
105
+ token_url_regex = /\/user\/spree_user\/password\/edit\?reset_password_token=(.*)$/
107
106
  token = token_url_regex.match(reset_password_email.body.to_s)[1]
108
107
 
109
108
  visit spree.edit_spree_user_password_path(reset_password_token: token)
@@ -39,7 +39,7 @@ RSpec.feature 'Sign In', type: :feature do
39
39
  click_button 'Login'
40
40
 
41
41
  expect(page).to have_text 'Logged in as: admin@person.com'
42
- expect(current_path).to eq '/admin/orders'
42
+ expect(current_path).to eq '/admin/dashboards/home'
43
43
  end
44
44
 
45
45
  it "should store the user previous location" do
@@ -5,14 +5,14 @@ RSpec.describe Spree::UserMailer, type: :mailer do
5
5
 
6
6
  before do
7
7
  user = create(:user)
8
- Spree::UserMailer.reset_password_instructions(user, 'token goes here').deliver
8
+ Spree::UserMailer.reset_password_instructions(user, 'token goes here').deliver_now
9
9
  @message = ActionMailer::Base.deliveries.last
10
10
  end
11
11
 
12
12
  describe '#reset_password_instructions' do
13
13
  describe 'message contents' do
14
14
  before do
15
- described_class.reset_password_instructions(user, 'token goes here').deliver
15
+ described_class.reset_password_instructions(user, 'token goes here').deliver_now
16
16
  @message = ActionMailer::Base.deliveries.last
17
17
  end
18
18
 
@@ -38,7 +38,7 @@ RSpec.describe Spree::UserMailer, type: :mailer do
38
38
  describe 'legacy support for User object' do
39
39
  it 'sends an email' do
40
40
  expect {
41
- described_class.reset_password_instructions(user, 'token goes here').deliver
41
+ described_class.reset_password_instructions(user, 'token goes here').deliver_now
42
42
  }.to change(ActionMailer::Base.deliveries, :size).by(1)
43
43
  end
44
44
  end
@@ -1,5 +1,7 @@
1
1
  module ConfirmHelpers
2
2
  def set_confirmable_option(value)
3
+ # FIXME: This is terrible terribleness and causes anything loaded
4
+ # on the user at initialization to be lost.
3
5
  Spree::Auth::Config[:confirmable] = value
4
6
  Spree.send(:remove_const, 'User')
5
7
  load File.expand_path("../../../app/models/spree/user.rb", __FILE__)
@@ -8,4 +10,4 @@ end
8
10
 
9
11
  RSpec.configure do |c|
10
12
  c.include ConfirmHelpers
11
- end
13
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: solidus_auth_devise
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0
4
+ version: 1.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Solidus Team
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-06-03 00:00:00.000000000 Z
11
+ date: 2015-07-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: solidus_core
@@ -16,7 +16,7 @@ dependencies:
16
16
  requirements:
17
17
  - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: 1.0.0.pre
19
+ version: 1.0.0.pre2
20
20
  - - "<"
21
21
  - !ruby/object:Gem::Version
22
22
  version: '2'
@@ -26,7 +26,7 @@ dependencies:
26
26
  requirements:
27
27
  - - ">="
28
28
  - !ruby/object:Gem::Version
29
- version: 1.0.0.pre
29
+ version: 1.0.0.pre2
30
30
  - - "<"
31
31
  - !ruby/object:Gem::Version
32
32
  version: '2'
@@ -92,7 +92,7 @@ dependencies:
92
92
  requirements:
93
93
  - - ">="
94
94
  - !ruby/object:Gem::Version
95
- version: 1.0.0.pre
95
+ version: 1.0.0.pre2
96
96
  - - "<"
97
97
  - !ruby/object:Gem::Version
98
98
  version: '2'
@@ -102,7 +102,7 @@ dependencies:
102
102
  requirements:
103
103
  - - ">="
104
104
  - !ruby/object:Gem::Version
105
- version: 1.0.0.pre
105
+ version: 1.0.0.pre2
106
106
  - - "<"
107
107
  - !ruby/object:Gem::Version
108
108
  version: '2'
@@ -112,7 +112,7 @@ dependencies:
112
112
  requirements:
113
113
  - - ">="
114
114
  - !ruby/object:Gem::Version
115
- version: 1.0.0.pre
115
+ version: 1.0.0.pre2
116
116
  - - "<"
117
117
  - !ruby/object:Gem::Version
118
118
  version: '2'
@@ -122,7 +122,7 @@ dependencies:
122
122
  requirements:
123
123
  - - ">="
124
124
  - !ruby/object:Gem::Version
125
- version: 1.0.0.pre
125
+ version: 1.0.0.pre2
126
126
  - - "<"
127
127
  - !ruby/object:Gem::Version
128
128
  version: '2'
@@ -132,14 +132,14 @@ dependencies:
132
132
  requirements:
133
133
  - - "~>"
134
134
  - !ruby/object:Gem::Version
135
- version: 3.0.0
135
+ version: '3.3'
136
136
  type: :development
137
137
  prerelease: false
138
138
  version_requirements: !ruby/object:Gem::Requirement
139
139
  requirements:
140
140
  - - "~>"
141
141
  - !ruby/object:Gem::Version
142
- version: 3.0.0
142
+ version: '3.3'
143
143
  - !ruby/object:Gem::Dependency
144
144
  name: simplecov
145
145
  requirement: !ruby/object:Gem::Requirement
@@ -313,7 +313,6 @@ files:
313
313
  - lib/assets/stylesheets/spree/frontend/solidus_auth.css
314
314
  - lib/controllers/backend/spree/admin/admin_controller_decorator.rb
315
315
  - lib/controllers/backend/spree/admin/admin_orders_controller_decorator.rb
316
- - lib/controllers/backend/spree/admin/admin_resource_controller_decorator.rb
317
316
  - lib/controllers/backend/spree/admin/orders/customer_details_controller_decorator.rb
318
317
  - lib/controllers/backend/spree/admin/user_passwords_controller.rb
319
318
  - lib/controllers/backend/spree/admin/user_sessions_controller.rb
@@ -323,8 +322,8 @@ files:
323
322
  - lib/controllers/frontend/spree/user_registrations_controller.rb
324
323
  - lib/controllers/frontend/spree/user_sessions_controller.rb
325
324
  - lib/controllers/frontend/spree/users_controller.rb
326
- - lib/generators/spree/auth/install/install_generator.rb
327
- - lib/generators/spree/auth/install/templates/config/initializers/devise.rb
325
+ - lib/generators/solidus/auth/install/install_generator.rb
326
+ - lib/generators/solidus/auth/install/templates/config/initializers/devise.rb
328
327
  - lib/solidus/auth.rb
329
328
  - lib/solidus_auth_devise.rb
330
329
  - lib/spree/auth/devise.rb
@@ -1,3 +0,0 @@
1
- Spree::Admin::ResourceController.class_eval do
2
- rescue_from CanCan::AccessDenied, :with => :unauthorized
3
- end