spree_auth_devise 4.2.0 → 4.3.4
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/.gem_release.yml +2 -0
- data/.travis.yml +6 -3
- data/Gemfile +1 -0
- data/app/controllers/spree/user_confirmations_controller.rb +25 -0
- data/app/controllers/spree/user_passwords_controller.rb +16 -3
- data/app/controllers/spree/user_registrations_controller.rb +17 -3
- data/app/controllers/spree/user_sessions_controller.rb +12 -5
- data/app/mailers/spree/user_mailer.rb +6 -3
- data/app/models/spree/user.rb +29 -0
- data/app/views/spree/user_mailer/confirmation_instructions.html.erb +20 -0
- data/app/views/spree/user_mailer/confirmation_instructions.text.erb +7 -4
- data/app/views/spree/user_mailer/reset_password_instructions.html.erb +20 -0
- data/app/views/spree/user_mailer/reset_password_instructions.text.erb +9 -2
- data/config/initializers/warden.rb +1 -1
- data/config/locales/de.yml +0 -2
- data/config/locales/en.yml +14 -6
- data/config/locales/zh-TW.yml +0 -2
- data/config/routes.rb +3 -1
- data/lib/controllers/backend/spree/admin/user_sessions_controller.rb +16 -0
- data/lib/controllers/frontend/spree/checkout_controller_decorator.rb +2 -1
- data/lib/controllers/frontend/spree/users_controller.rb +1 -1
- data/lib/spree/auth/engine.rb +1 -9
- data/lib/spree/auth/version.rb +9 -0
- data/lib/spree/testing_support/auth_helpers.rb +18 -10
- data/lib/spree_auth_devise.rb +0 -1
- data/lib/views/backend/spree/admin/user_sessions/new.html.erb +1 -1
- data/spec/controllers/spree/user_sessions_controller_spec.rb +13 -1
- data/spec/controllers/spree/users_controller_spec.rb +1 -1
- data/spec/features/account_spec.rb +2 -2
- data/spec/features/admin/orders_spec.rb +2 -1
- data/spec/features/admin/sign_in_spec.rb +4 -3
- data/spec/features/admin/sign_out_spec.rb +3 -3
- data/spec/features/admin_permissions_spec.rb +1 -1
- data/spec/features/checkout_spec.rb +3 -3
- data/spec/features/confirmation_spec.rb +2 -5
- data/spec/features/order_spec.rb +2 -2
- data/spec/features/sign_in_spec.rb +28 -5
- data/spec/features/sign_out_spec.rb +2 -2
- data/spec/mailers/user_mailer_spec.rb +1 -1
- data/spec/models/user_spec.rb +39 -8
- data/spec/spec_helper.rb +4 -0
- data/spec/support/confirm_helpers.rb +21 -8
- data/spree_auth_devise.gemspec +14 -5
- metadata +14 -22
- data/app/overrides/spree/admin/shared/_header/auth_admin_login_navigation_bar.html.erb.deface +0 -4
- data/spec/support/user_helper.rb +0 -11
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3e12256ddf3e493e918afe0f529f5abf35fe8db54ac04623081c96f82c4b8bb1
|
4
|
+
data.tar.gz: 898d1757061761ff25aeb56dbc09a8c111d21881051526fd0e842c30a6d264e4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b54d41d158228c72e3167d8354f1ba352030533885776a3a7c2a30dc675ac2055627bf48c5da724e5104e0004b4f8cfca1504ded6ceaed0e4c632edc9c95cce4
|
7
|
+
data.tar.gz: dfc8ac967964ee75c706e138c015b627e303798c7bbb88fe4ee63077149717ece0c8474d7888cc6280ea2c0a4fad363ecf1f1f4516f47ef80fe93c0abbf8cfe5
|
data/.gem_release.yml
ADDED
data/.travis.yml
CHANGED
@@ -15,8 +15,8 @@ services:
|
|
15
15
|
language: ruby
|
16
16
|
|
17
17
|
rvm:
|
18
|
-
- 2.
|
19
|
-
-
|
18
|
+
- 2.7
|
19
|
+
- 3.0
|
20
20
|
|
21
21
|
env:
|
22
22
|
- DB=mysql
|
@@ -27,8 +27,11 @@ gemfile:
|
|
27
27
|
- gemfiles/spree_master.gemfile
|
28
28
|
|
29
29
|
jobs:
|
30
|
+
exclude:
|
31
|
+
- rvm: 3.0
|
32
|
+
gemfile: gemfiles/spree_4_1.gemfile
|
30
33
|
allow_failures:
|
31
|
-
|
34
|
+
- gemfile: gemfiles/spree_master.gemfile
|
32
35
|
|
33
36
|
before_install:
|
34
37
|
- mysql -u root -e "GRANT ALL ON *.* TO 'travis'@'%';"
|
data/Gemfile
CHANGED
@@ -6,8 +6,33 @@ class Spree::UserConfirmationsController < Devise::ConfirmationsController
|
|
6
6
|
include Spree::Core::ControllerHelpers::Order
|
7
7
|
include Spree::Core::ControllerHelpers::Store
|
8
8
|
|
9
|
+
include SpreeI18n::ControllerLocaleHelper if defined?(SpreeI18n::ControllerLocaleHelper)
|
10
|
+
|
11
|
+
include Spree::Core::ControllerHelpers::Currency if defined?(Spree::Core::ControllerHelpers::Currency)
|
12
|
+
include Spree::Core::ControllerHelpers::Locale if defined?(Spree::Core::ControllerHelpers::Locale)
|
13
|
+
|
14
|
+
include Spree::LocaleUrls if defined?(Spree::LocaleUrls)
|
15
|
+
|
16
|
+
helper 'spree/locale' if defined?(Spree::LocaleHelper)
|
17
|
+
helper 'spree/currency' if defined?(Spree::CurrencyHelper)
|
18
|
+
helper 'spree/store' if defined?(Spree::StoreHelper)
|
19
|
+
|
9
20
|
before_action :set_current_order
|
10
21
|
|
22
|
+
if Spree.version.to_f >= 4.2
|
23
|
+
# POST /resource/confirmation
|
24
|
+
def create
|
25
|
+
self.resource = resource_class.send_confirmation_instructions(resource_params, current_store)
|
26
|
+
yield resource if block_given?
|
27
|
+
|
28
|
+
if successfully_sent?(resource)
|
29
|
+
respond_with({}, location: after_resending_confirmation_instructions_path_for(resource_name))
|
30
|
+
else
|
31
|
+
respond_with(resource)
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
11
36
|
# GET /resource/confirmation?confirmation_token=abcdef
|
12
37
|
def show
|
13
38
|
self.resource = resource_class.confirm_by_token(params[:confirmation_token])
|
@@ -6,9 +6,16 @@ class Spree::UserPasswordsController < Devise::PasswordsController
|
|
6
6
|
include Spree::Core::ControllerHelpers::Order
|
7
7
|
include Spree::Core::ControllerHelpers::Store
|
8
8
|
|
9
|
-
if defined?(SpreeI18n::ControllerLocaleHelper)
|
10
|
-
|
11
|
-
|
9
|
+
include SpreeI18n::ControllerLocaleHelper if defined?(SpreeI18n::ControllerLocaleHelper)
|
10
|
+
|
11
|
+
include Spree::Core::ControllerHelpers::Currency if defined?(Spree::Core::ControllerHelpers::Currency)
|
12
|
+
include Spree::Core::ControllerHelpers::Locale if defined?(Spree::Core::ControllerHelpers::Locale)
|
13
|
+
|
14
|
+
include Spree::LocaleUrls if defined?(Spree::LocaleUrls)
|
15
|
+
|
16
|
+
helper 'spree/locale' if defined?(Spree::LocaleHelper)
|
17
|
+
helper 'spree/currency' if defined?(Spree::CurrencyHelper)
|
18
|
+
helper 'spree/store' if defined?(Spree::StoreHelper)
|
12
19
|
|
13
20
|
before_action :set_current_order
|
14
21
|
|
@@ -53,4 +60,10 @@ class Spree::UserPasswordsController < Devise::PasswordsController
|
|
53
60
|
def new_session_path(resource_name)
|
54
61
|
spree.send("new_#{resource_name}_session_path")
|
55
62
|
end
|
63
|
+
|
64
|
+
private
|
65
|
+
|
66
|
+
def accurate_title
|
67
|
+
Spree.t(:reset_password)
|
68
|
+
end
|
56
69
|
end
|
@@ -6,9 +6,16 @@ class Spree::UserRegistrationsController < Devise::RegistrationsController
|
|
6
6
|
include Spree::Core::ControllerHelpers::Order
|
7
7
|
include Spree::Core::ControllerHelpers::Store
|
8
8
|
|
9
|
-
if defined?(SpreeI18n::ControllerLocaleHelper)
|
10
|
-
|
11
|
-
|
9
|
+
include SpreeI18n::ControllerLocaleHelper if defined?(SpreeI18n::ControllerLocaleHelper)
|
10
|
+
|
11
|
+
include Spree::Core::ControllerHelpers::Currency if defined?(Spree::Core::ControllerHelpers::Currency)
|
12
|
+
include Spree::Core::ControllerHelpers::Locale if defined?(Spree::Core::ControllerHelpers::Locale)
|
13
|
+
|
14
|
+
include Spree::LocaleUrls if defined?(Spree::LocaleUrls)
|
15
|
+
|
16
|
+
helper 'spree/locale' if defined?(Spree::LocaleHelper)
|
17
|
+
helper 'spree/currency' if defined?(Spree::CurrencyHelper)
|
18
|
+
helper 'spree/store' if defined?(Spree::StoreHelper)
|
12
19
|
|
13
20
|
before_action :check_permissions, only: [:edit, :update]
|
14
21
|
before_action :set_current_order
|
@@ -23,6 +30,7 @@ class Spree::UserRegistrationsController < Devise::RegistrationsController
|
|
23
30
|
# POST /resource/sign_up
|
24
31
|
def create
|
25
32
|
@user = build_resource(spree_user_params)
|
33
|
+
resource.skip_confirmation_notification! if Spree::Auth::Config[:confirmable]
|
26
34
|
resource_saved = resource.save
|
27
35
|
yield resource if block_given?
|
28
36
|
if resource_saved
|
@@ -30,10 +38,12 @@ class Spree::UserRegistrationsController < Devise::RegistrationsController
|
|
30
38
|
set_flash_message :notice, :signed_up
|
31
39
|
sign_up(resource_name, resource)
|
32
40
|
session[:spree_user_signup] = true
|
41
|
+
resource.send_confirmation_instructions(current_store) if Spree::Auth::Config[:confirmable]
|
33
42
|
redirect_to_checkout_or_account_path(resource)
|
34
43
|
else
|
35
44
|
set_flash_message :notice, :"signed_up_but_#{resource.inactive_message}"
|
36
45
|
expire_data_after_sign_in!
|
46
|
+
resource.send_confirmation_instructions(current_store) if Spree::Auth::Config[:confirmable]
|
37
47
|
respond_with resource, location: after_inactive_sign_up_path_for(resource)
|
38
48
|
end
|
39
49
|
else
|
@@ -89,6 +99,10 @@ class Spree::UserRegistrationsController < Devise::RegistrationsController
|
|
89
99
|
|
90
100
|
private
|
91
101
|
|
102
|
+
def accurate_title
|
103
|
+
Spree.t(:sign_up)
|
104
|
+
end
|
105
|
+
|
92
106
|
def spree_user_params
|
93
107
|
params.require(:spree_user).permit(Spree::PermittedAttributes.user_attributes)
|
94
108
|
end
|
@@ -6,9 +6,16 @@ class Spree::UserSessionsController < Devise::SessionsController
|
|
6
6
|
include Spree::Core::ControllerHelpers::Order
|
7
7
|
include Spree::Core::ControllerHelpers::Store
|
8
8
|
|
9
|
-
if defined?(SpreeI18n::ControllerLocaleHelper)
|
10
|
-
|
11
|
-
|
9
|
+
include SpreeI18n::ControllerLocaleHelper if defined?(SpreeI18n::ControllerLocaleHelper)
|
10
|
+
|
11
|
+
include Spree::Core::ControllerHelpers::Currency if defined?(Spree::Core::ControllerHelpers::Currency)
|
12
|
+
include Spree::Core::ControllerHelpers::Locale if defined?(Spree::Core::ControllerHelpers::Locale)
|
13
|
+
|
14
|
+
include Spree::LocaleUrls if defined?(Spree::LocaleUrls)
|
15
|
+
|
16
|
+
helper 'spree/locale' if defined?(Spree::LocaleHelper)
|
17
|
+
helper 'spree/currency' if defined?(Spree::CurrencyHelper)
|
18
|
+
helper 'spree/store' if defined?(Spree::StoreHelper)
|
12
19
|
|
13
20
|
before_action :set_current_order
|
14
21
|
|
@@ -58,7 +65,7 @@ class Spree::UserSessionsController < Devise::SessionsController
|
|
58
65
|
end
|
59
66
|
|
60
67
|
def after_sign_in_redirect(resource_or_scope)
|
61
|
-
stored_location_for(resource_or_scope) || account_path
|
68
|
+
stored_location_for(resource_or_scope) || spree.account_path
|
62
69
|
end
|
63
70
|
|
64
71
|
def respond_to_on_destroy
|
@@ -74,6 +81,6 @@ class Spree::UserSessionsController < Devise::SessionsController
|
|
74
81
|
scope = Devise::Mapping.find_scope!(resource_or_scope)
|
75
82
|
router_name = Devise.mappings[scope].router_name
|
76
83
|
context = router_name ? send(router_name) : self
|
77
|
-
context.respond_to?(:login_path) ? context.login_path :
|
84
|
+
context.respond_to?(:login_path) ? context.login_path : spree.root_path
|
78
85
|
end
|
79
86
|
end
|
@@ -6,15 +6,18 @@ module Spree
|
|
6
6
|
@locale = @current_store.has_attribute?(:default_locale) ? @current_store.default_locale : I18n.default_locale
|
7
7
|
I18n.locale = @locale if @locale.present?
|
8
8
|
@edit_password_reset_url = spree.edit_spree_user_password_url(reset_password_token: token, host: @current_store.url)
|
9
|
+
@user = user
|
9
10
|
|
10
|
-
mail to: user.email, from: from_address, subject: @current_store.name + ' ' + I18n.t(:subject, scope: [:devise, :mailer, :reset_password_instructions])
|
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
12
|
end
|
12
13
|
|
13
14
|
def confirmation_instructions(user, token, _opts = {})
|
14
|
-
|
15
|
+
current_store_id = _opts[:current_store_id]
|
16
|
+
@current_store = Spree::Store.find(current_store_id) || Spree::Store.current
|
17
|
+
@confirmation_url = spree.confirmation_url(confirmation_token: token, host: Spree::Store.current.url)
|
15
18
|
@email = user.email
|
16
19
|
|
17
|
-
mail to: user.email, from: from_address, subject:
|
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
|
18
21
|
end
|
19
22
|
end
|
20
23
|
end
|
data/app/models/spree/user.rb
CHANGED
@@ -27,6 +27,31 @@ module Spree
|
|
27
27
|
has_spree_role?('admin')
|
28
28
|
end
|
29
29
|
|
30
|
+
def self.send_confirmation_instructions(attributes = {}, current_store)
|
31
|
+
confirmable = find_by_unconfirmed_email_with_errors(attributes) if reconfirmable
|
32
|
+
unless confirmable.try(:persisted?)
|
33
|
+
confirmable = find_or_initialize_with_errors(confirmation_keys, attributes, :not_found)
|
34
|
+
end
|
35
|
+
confirmable.resend_confirmation_instructions(current_store) if confirmable.persisted?
|
36
|
+
confirmable
|
37
|
+
end
|
38
|
+
|
39
|
+
def resend_confirmation_instructions(current_store)
|
40
|
+
pending_any_confirmation do
|
41
|
+
send_confirmation_instructions(current_store)
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
def send_confirmation_instructions(current_store)
|
46
|
+
unless @raw_confirmation_token
|
47
|
+
generate_confirmation_token!
|
48
|
+
end
|
49
|
+
|
50
|
+
opts = pending_reconfirmation? ? { to: unconfirmed_email } : {}
|
51
|
+
opts[:current_store_id] = current_store&.id || Spree::Store.default.id
|
52
|
+
send_devise_notification(:confirmation_instructions, @raw_confirmation_token, opts)
|
53
|
+
end
|
54
|
+
|
30
55
|
def self.send_reset_password_instructions(attributes={}, current_store)
|
31
56
|
recoverable = find_or_initialize_with_errors(reset_password_keys, attributes, :not_found)
|
32
57
|
recoverable.send_reset_password_instructions(current_store) if recoverable.persisted?
|
@@ -46,6 +71,10 @@ module Spree
|
|
46
71
|
|
47
72
|
protected
|
48
73
|
|
74
|
+
def send_on_create_confirmation_instructions(current_store = nil)
|
75
|
+
send_confirmation_instructions(current_store || Spree::Store.default)
|
76
|
+
end
|
77
|
+
|
49
78
|
def password_required?
|
50
79
|
!persisted? || password.present? || password_confirmation.present?
|
51
80
|
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
<h1>
|
2
|
+
<%= Spree.t('user_mailer.confirmation_instructions.welcome', email: @email) %>
|
3
|
+
</h1>
|
4
|
+
<p>
|
5
|
+
<%= Spree.t('user_mailer.confirmation_instructions.instructions_1', { store_name: @current_store.name }) %>
|
6
|
+
</p>
|
7
|
+
<p>
|
8
|
+
<%= Spree.t('user_mailer.confirmation_instructions.instructions_2') %>
|
9
|
+
</p>
|
10
|
+
<p class="body-action">
|
11
|
+
<a href="<%= @confirmation_url %>" class="button button--green"><%= Spree.t('user_mailer.confirmation_instructions.button') %></a>
|
12
|
+
</p>
|
13
|
+
<p>
|
14
|
+
<%= Spree.t('user_mailer.confirmation_instructions.instructions_3') %>
|
15
|
+
</p>
|
16
|
+
<p>
|
17
|
+
<%= Spree.t('user_mailer.confirmation_instructions.thanks') %>
|
18
|
+
<br />
|
19
|
+
<%= Spree.t('user_mailer.confirmation_instructions.store_team', { store_name: @current_store.name }) %>
|
20
|
+
</p>
|
@@ -1,5 +1,8 @@
|
|
1
|
-
<%= Spree.t('confirmation_instructions.welcome', email: @email) %>
|
2
|
-
|
3
|
-
<%= Spree.t('confirmation_instructions.
|
4
|
-
|
1
|
+
<%= Spree.t('user_mailer.confirmation_instructions.welcome', email: @email) %>
|
2
|
+
<%= Spree.t('user_mailer.confirmation_instructions.instructions_1', { store_name: @current_store.name }) %>
|
3
|
+
<%= Spree.t('user_mailer.confirmation_instructions.instructions_2') %>
|
4
|
+
<%= Spree.t('user_mailer.confirmation_instructions.button') %>
|
5
5
|
<%= @confirmation_url %>
|
6
|
+
<%= Spree.t('user_mailer.confirmation_instructions.instructions_3') %>
|
7
|
+
<%= Spree.t('user_mailer.confirmation_instructions.thanks') %>
|
8
|
+
<%= Spree.t('user_mailer.confirmation_instructions.store_team', { store_name: @current_store.name }) %>
|
@@ -0,0 +1,20 @@
|
|
1
|
+
<h1>
|
2
|
+
<%= Spree.t('user_mailer.reset_password_instructions.welcome', email: @user.email) %>
|
3
|
+
</h1>
|
4
|
+
<p>
|
5
|
+
<%= Spree.t('user_mailer.reset_password_instructions.instructions_1', { store_name: @current_store.name }) %>
|
6
|
+
</p>
|
7
|
+
<p>
|
8
|
+
<%= Spree.t('user_mailer.reset_password_instructions.instructions_2') %>
|
9
|
+
</p>
|
10
|
+
<p class="body-action">
|
11
|
+
<a href="<%= @edit_password_reset_url %>" class="button button--green"><%= Spree.t('user_mailer.reset_password_instructions.button') %></a>
|
12
|
+
</p>
|
13
|
+
<p>
|
14
|
+
<%= Spree.t('user_mailer.reset_password_instructions.instructions_3') %>
|
15
|
+
</p>
|
16
|
+
<p>
|
17
|
+
<%= Spree.t('user_mailer.reset_password_instructions.thanks') %>
|
18
|
+
<br />
|
19
|
+
<%= Spree.t('user_mailer.reset_password_instructions.store_team', { store_name: @current_store.name }) %>
|
20
|
+
</p>
|
@@ -1,5 +1,12 @@
|
|
1
|
-
<%= Spree.t('user_mailer.reset_password_instructions.
|
1
|
+
<%= Spree.t('user_mailer.reset_password_instructions.welcome', email: @user.email) %>
|
2
2
|
|
3
|
+
<%= Spree.t('user_mailer.reset_password_instructions.instructions_1', { store_name: @current_store.name }) %>
|
4
|
+
<%= Spree.t('user_mailer.reset_password_instructions.instructions_2') %>
|
5
|
+
|
6
|
+
<%= Spree.t('user_mailer.reset_password_instructions.button') %>
|
3
7
|
<%= @edit_password_reset_url %>
|
4
8
|
|
5
|
-
<%= Spree.t('user_mailer.reset_password_instructions.
|
9
|
+
<%= Spree.t('user_mailer.reset_password_instructions.instructions_3') %>
|
10
|
+
|
11
|
+
<%= Spree.t('user_mailer.reset_password_instructions.thanks') %>
|
12
|
+
<%= Spree.t('user_mailer.reset_password_instructions.store_team', { store_name: @current_store.name }) %>
|
@@ -3,7 +3,7 @@ Warden::Manager.after_set_user except: :fetch do |user, auth, _opts|
|
|
3
3
|
token = auth.cookies.signed[:guest_token] || auth.cookies.signed[:token]
|
4
4
|
token_attr = Spree::Order.has_attribute?(:token) ? :token : :guest_token
|
5
5
|
|
6
|
-
if token.present? && user.is_a?(Spree
|
6
|
+
if token.present? && user.is_a?(Spree.user_class)
|
7
7
|
Spree::Order.incomplete.where(token_attr => token, user_id: nil).each do |order|
|
8
8
|
order.associate_user!(user)
|
9
9
|
end
|
data/config/locales/de.yml
CHANGED
@@ -3,8 +3,6 @@ de:
|
|
3
3
|
spree:
|
4
4
|
admin_login: Admin Login
|
5
5
|
change_your_password: Kennwort zurücksetzen
|
6
|
-
store_credits:
|
7
|
-
credit_balance: Saldo des Guthabens
|
8
6
|
user_mailer:
|
9
7
|
reset_password_instructions:
|
10
8
|
instructions_1: "Es wurde eine Anfrage zum Zurücksetzen Ihres Passworts gestellt.\nWenn Sie diese Anfrage nicht gestellt haben, ignorieren Sie diese E-Mail.\n\nWenn Sie diese Anfrage gestellt haben, klicken Sie bitte auf den folgenden Link:"
|
data/config/locales/en.yml
CHANGED
@@ -3,18 +3,26 @@ en:
|
|
3
3
|
spree:
|
4
4
|
admin_login: "Admin Login"
|
5
5
|
change_your_password: "Change your password"
|
6
|
-
store_credits:
|
7
|
-
credit_balance: Store Credit Balance
|
8
6
|
user_mailer:
|
9
7
|
reset_password_instructions:
|
10
|
-
|
11
|
-
|
8
|
+
welcome: "Hi %{email}"
|
9
|
+
instructions_1: "A request to reset the password for your %{store_name} account has been made."
|
10
|
+
instructions_2: Click the button below to reset it.
|
11
|
+
instructions_3: If you did not request a password change ignore this email or contact us.
|
12
|
+
button: Reset your password
|
13
|
+
thanks: Thank you,
|
14
|
+
store_team: "%{store_name} Team"
|
12
15
|
confirmation_instructions:
|
13
16
|
welcome: "Welcome %{email}!"
|
14
|
-
|
17
|
+
instructions_1: "Thanks for registering at %{store_name}."
|
18
|
+
instructions_2: "Click the button below to confirm your account:"
|
19
|
+
instructions_3: If you have any questions, feel free to simply reply to this email.
|
20
|
+
button: Confirm email address
|
21
|
+
thanks: Thank you,
|
22
|
+
store_team: "%{store_name} Team"
|
15
23
|
devise:
|
16
24
|
confirmations:
|
17
|
-
confirmed: Your account was successfully confirmed. You
|
25
|
+
confirmed: Your account was successfully confirmed. You can now log in.
|
18
26
|
send_instructions: You will receive an email with instructions about how to confirm your account in a few minutes.
|
19
27
|
spree_user:
|
20
28
|
already_confirmed: Email was already confirmed, please try signing in.
|
data/config/locales/zh-TW.yml
CHANGED
data/config/routes.rb
CHANGED
@@ -21,7 +21,7 @@ Spree::Core::Engine.add_routes do
|
|
21
21
|
post '/password/recover' => 'user_passwords#create', :as => :reset_password
|
22
22
|
get '/password/change' => 'user_passwords#edit', :as => :edit_password
|
23
23
|
put '/password/change' => 'user_passwords#update', :as => :update_password
|
24
|
-
get '/confirm' => 'user_confirmations#show', :as => :confirmation
|
24
|
+
get '/confirm' => 'user_confirmations#show', :as => :confirmation
|
25
25
|
end
|
26
26
|
|
27
27
|
get '/checkout/registration' => 'checkout#registration', :as => :checkout_registration
|
@@ -42,6 +42,8 @@ Spree::Core::Engine.add_routes do
|
|
42
42
|
get '/login' => 'user_sessions#new', :as => :login
|
43
43
|
post '/login' => 'user_sessions#create', :as => :create_new_session
|
44
44
|
get '/logout' => 'user_sessions#destroy', :as => :logout
|
45
|
+
get '/password/recover' => 'user_passwords#new', :as => :recover_password
|
46
|
+
post '/password/recover' => 'user_passwords#create', :as => :reset_password
|
45
47
|
end
|
46
48
|
end
|
47
49
|
|
@@ -59,4 +59,20 @@ class Spree::Admin::UserSessionsController < Devise::SessionsController
|
|
59
59
|
"spree/layouts/admin"
|
60
60
|
end
|
61
61
|
end
|
62
|
+
|
63
|
+
def respond_to_on_destroy
|
64
|
+
# We actually need to hardcode this as Rails default responder doesn't
|
65
|
+
# support returning empty response on GET request
|
66
|
+
respond_to do |format|
|
67
|
+
format.all { head :no_content }
|
68
|
+
format.any(*navigational_formats) { redirect_to after_sign_out_redirect(resource_name) }
|
69
|
+
end
|
70
|
+
end
|
71
|
+
|
72
|
+
def after_sign_out_redirect(resource_or_scope)
|
73
|
+
scope = Devise::Mapping.find_scope!(resource_or_scope)
|
74
|
+
router_name = Devise.mappings[scope].router_name
|
75
|
+
context = router_name ? send(router_name) : self
|
76
|
+
context.respond_to?(:admin_login_path) ? context.admin_login_path : "/"
|
77
|
+
end
|
62
78
|
end
|
@@ -34,7 +34,7 @@ class Spree::UsersController < Spree::StoreController
|
|
34
34
|
bypass_sign_in(@user)
|
35
35
|
end
|
36
36
|
end
|
37
|
-
redirect_to spree.
|
37
|
+
redirect_to spree.account_path, notice: Spree.t(:account_updated)
|
38
38
|
else
|
39
39
|
render :edit
|
40
40
|
end
|
data/lib/spree/auth/engine.rb
CHANGED
@@ -12,7 +12,7 @@ module Spree
|
|
12
12
|
end
|
13
13
|
|
14
14
|
initializer "spree_auth_devise.set_user_class", after: :load_config_initializers do
|
15
|
-
Spree.user_class =
|
15
|
+
Spree.user_class = 'Spree::User' if Spree.user_class.blank? || Spree.user_class.to_s == 'Spree::LegacyUser'
|
16
16
|
end
|
17
17
|
|
18
18
|
initializer "spree_auth_devise.check_secret_token" do
|
@@ -29,19 +29,11 @@ module Spree
|
|
29
29
|
Rails.configuration.cache_classes ? require(c) : load(c)
|
30
30
|
end
|
31
31
|
if Spree::Auth::Engine.backend_available?
|
32
|
-
Rails.application.config.assets.precompile += [
|
33
|
-
'lib/assets/javascripts/spree/backend/spree_auth.js',
|
34
|
-
'lib/assets/javascripts/spree/backend/spree_auth.css'
|
35
|
-
]
|
36
32
|
Dir.glob(File.join(File.dirname(__FILE__), "../../controllers/backend/*/*/*_decorator*.rb")) do |c|
|
37
33
|
Rails.configuration.cache_classes ? require(c) : load(c)
|
38
34
|
end
|
39
35
|
end
|
40
36
|
if Spree::Auth::Engine.frontend_available?
|
41
|
-
Rails.application.config.assets.precompile += [
|
42
|
-
'lib/assets/javascripts/spree/frontend/spree_auth.js',
|
43
|
-
'lib/assets/javascripts/spree/frontend/spree_auth.css'
|
44
|
-
]
|
45
37
|
Dir.glob(File.join(File.dirname(__FILE__), "../../controllers/frontend/**/*_decorator*.rb")) do |c|
|
46
38
|
Rails.configuration.cache_classes ? require(c) : load(c)
|
47
39
|
end
|
@@ -1,34 +1,42 @@
|
|
1
1
|
module Spree
|
2
2
|
module TestingSupport
|
3
3
|
module AuthHelpers
|
4
|
-
def
|
5
|
-
|
4
|
+
def login_button
|
5
|
+
Spree.version.to_f == 4.1 ? Spree.t(:log_in) : Spree.t(:login)
|
6
|
+
end
|
7
|
+
|
8
|
+
def logout_button
|
9
|
+
Spree.version.to_f == 4.1 ? Spree.t('nav_bar.log_out') : Spree.t(:logout).upcase
|
10
|
+
end
|
11
|
+
|
12
|
+
def log_in(email:, password:, remember_me: true, locale: nil)
|
13
|
+
visit spree.login_path(locale: locale)
|
6
14
|
|
7
|
-
fill_in
|
8
|
-
fill_in
|
15
|
+
fill_in Spree.t(:email), with: email
|
16
|
+
fill_in Spree.t(:password), with: password
|
9
17
|
|
10
18
|
# Regression test for #1257
|
11
|
-
first('label', text:
|
12
|
-
click_button
|
19
|
+
first('label', text: Spree.t(:remember_me)).click if remember_me
|
20
|
+
click_button login_button
|
13
21
|
|
14
|
-
expect(page).to have_content
|
22
|
+
expect(page).to have_content Spree.t(:logged_in_succesfully)
|
15
23
|
end
|
16
24
|
|
17
25
|
def log_out
|
18
26
|
show_user_menu
|
19
|
-
click_link
|
27
|
+
click_link logout_button
|
20
28
|
|
21
29
|
expect(page).to have_content 'Signed out successfully'
|
22
30
|
end
|
23
31
|
|
24
32
|
def show_user_menu
|
25
|
-
find("button[aria-label='
|
33
|
+
find("button[aria-label='#{Spree.t('nav_bar.show_user_menu')}']").click
|
26
34
|
end
|
27
35
|
|
28
36
|
def show_user_account
|
29
37
|
within '#nav-bar' do
|
30
38
|
show_user_menu
|
31
|
-
click_link
|
39
|
+
click_link Spree.t(:my_account).upcase
|
32
40
|
end
|
33
41
|
end
|
34
42
|
end
|
data/lib/spree_auth_devise.rb
CHANGED
@@ -137,7 +137,7 @@ RSpec.describe Spree::UserSessionsController, type: :controller do
|
|
137
137
|
request.cookie_jar.signed[:guest_token] = 'ABC'
|
138
138
|
request.cookie_jar.signed[:token] = 'DEF'
|
139
139
|
end
|
140
|
-
|
140
|
+
|
141
141
|
it 'assigns the correct token attribute for the order' do
|
142
142
|
if Spree.version.to_f > 3.6
|
143
143
|
order = create(:order, email: user.email, token: 'ABC', user_id: nil, created_by_id: nil)
|
@@ -157,6 +157,18 @@ RSpec.describe Spree::UserSessionsController, type: :controller do
|
|
157
157
|
post :create, params: { spree_user: { email: user.email, password: 'secret' }}
|
158
158
|
expect(response).to redirect_to spree.account_path
|
159
159
|
end
|
160
|
+
|
161
|
+
context 'different locale' do
|
162
|
+
before do
|
163
|
+
Spree::Store.default.update(default_locale: 'en', supported_locales: 'en,fr') if Spree.version.to_f >= 4.2
|
164
|
+
end
|
165
|
+
|
166
|
+
it 'redirects to localized account path after signing in' do
|
167
|
+
skip if Spree.version.to_f < 4.2
|
168
|
+
post :create, params: { spree_user: { email: user.email, password: 'secret' }, locale: 'fr' }
|
169
|
+
expect(response).to redirect_to spree.account_path(locale: 'fr')
|
170
|
+
end
|
171
|
+
end
|
160
172
|
end
|
161
173
|
|
162
174
|
context "and js format is used" do
|
@@ -25,7 +25,7 @@ RSpec.describe Spree::UsersController, type: :controller do
|
|
25
25
|
it 'performs update' do
|
26
26
|
put :update, params: { user: { email: 'mynew@email-address.com' } }
|
27
27
|
expect(assigns[:user].email).to eq 'mynew@email-address.com'
|
28
|
-
expect(response).to redirect_to spree.
|
28
|
+
expect(response).to redirect_to spree.account_path
|
29
29
|
end
|
30
30
|
end
|
31
31
|
|
@@ -10,7 +10,7 @@ RSpec.feature 'Accounts', type: :feature do
|
|
10
10
|
|
11
11
|
fill_in 'Email', with: user.email
|
12
12
|
fill_in 'Password', with: user.password
|
13
|
-
click_button
|
13
|
+
click_button login_button
|
14
14
|
|
15
15
|
show_user_account
|
16
16
|
expect(page).to have_text 'admin@person.com'
|
@@ -43,7 +43,7 @@ RSpec.feature 'Accounts', type: :feature do
|
|
43
43
|
|
44
44
|
fill_in 'Email', with: user.email
|
45
45
|
fill_in 'Password', with: user.password
|
46
|
-
click_button
|
46
|
+
click_button login_button
|
47
47
|
|
48
48
|
show_user_account
|
49
49
|
expect(page).to have_text 'email@person.com'
|
@@ -13,8 +13,8 @@ RSpec.feature 'Admin - Sign In', type: :feature do
|
|
13
13
|
log_in(email: @user.email, password: 'secret')
|
14
14
|
show_user_menu
|
15
15
|
|
16
|
-
expect(page).not_to have_text
|
17
|
-
expect(page).to have_text
|
16
|
+
expect(page).not_to have_text login_button.upcase
|
17
|
+
expect(page).to have_text logout_button.upcase
|
18
18
|
expect(current_path).to eq '/account'
|
19
19
|
end
|
20
20
|
|
@@ -33,7 +33,8 @@ RSpec.feature 'Admin - Sign In', type: :feature do
|
|
33
33
|
|
34
34
|
fill_in 'Email', with: user.email
|
35
35
|
fill_in 'Password', with: 'secret'
|
36
|
-
click_button
|
36
|
+
click_button login_button
|
37
|
+
|
37
38
|
if Spree.version.to_f > 4.1
|
38
39
|
within '.navbar .dropdown-menu' do
|
39
40
|
expect(page).to have_text 'admin@person.com'
|
@@ -9,13 +9,13 @@ RSpec.feature 'Admin - Sign Out', type: :feature do
|
|
9
9
|
fill_in 'Password', with: 'secret'
|
10
10
|
# Regression test for #1257
|
11
11
|
check 'Remember me'
|
12
|
-
click_button
|
12
|
+
click_button Spree.t(:login)
|
13
13
|
end
|
14
14
|
|
15
15
|
scenario 'allows a signed in user to logout', js: true do
|
16
16
|
log_out
|
17
17
|
visit spree.admin_login_path
|
18
|
-
expect(page).to have_button
|
19
|
-
expect(page).not_to have_text
|
18
|
+
expect(page).to have_button Spree.t(:login)
|
19
|
+
expect(page).not_to have_text Spree.t(:logout)
|
20
20
|
end
|
21
21
|
end
|
@@ -55,7 +55,7 @@ RSpec.feature 'Checkout', :js, type: :feature do
|
|
55
55
|
visit spree.login_path
|
56
56
|
fill_in 'Email', with: user.email
|
57
57
|
fill_in 'Password', with: user.password
|
58
|
-
click_button
|
58
|
+
click_button login_button
|
59
59
|
expect(page).to have_text('Logged in successfully')
|
60
60
|
find('a.cart-icon').click
|
61
61
|
|
@@ -87,9 +87,9 @@ RSpec.feature 'Checkout', :js, type: :feature do
|
|
87
87
|
# The 'plain-text' version is sent in the email and there's one way to get that!
|
88
88
|
reset_password_email = ActionMailer::Base.deliveries.first
|
89
89
|
token_url_regex = /^http:\/\/www.example.com\/user\/spree_user\/password\/edit\?reset_password_token=(.*)$/
|
90
|
-
token = token_url_regex.match(reset_password_email.body.
|
90
|
+
token = token_url_regex.match(reset_password_email.body.encoded)[1]
|
91
91
|
|
92
|
-
visit spree.edit_spree_user_password_path(reset_password_token: token)
|
92
|
+
visit spree.edit_spree_user_password_path(reset_password_token: token.strip).tr("%0D","")
|
93
93
|
fill_in 'Password', with: 'password'
|
94
94
|
fill_in 'Password Confirmation', with: 'password'
|
95
95
|
click_button 'Update'
|
@@ -1,13 +1,10 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
|
-
RSpec.feature 'Confirmation', type: :feature,
|
3
|
+
RSpec.feature 'Confirmation', type: :feature, confirmable: true do
|
4
4
|
before do
|
5
|
-
|
6
|
-
Spree::UserMailer.stub(:confirmation_instructions).and_return(double(deliver: true))
|
5
|
+
expect(Spree::UserMailer).to receive(:confirmation_instructions).with(anything, anything, { current_store_id: Spree::Store.current.id }).and_return(double(deliver: true))
|
7
6
|
end
|
8
7
|
|
9
|
-
after(:each) { set_confirmable_option(false) }
|
10
|
-
|
11
8
|
background do
|
12
9
|
ActionMailer::Base.default_url_options[:host] = 'http://example.com'
|
13
10
|
end
|
data/spec/features/order_spec.rb
CHANGED
@@ -17,7 +17,7 @@ RSpec.feature 'Orders', :js, type: :feature do
|
|
17
17
|
visit spree.login_path
|
18
18
|
fill_in 'Email', with: user.email
|
19
19
|
fill_in 'Password', with: user.password
|
20
|
-
click_button
|
20
|
+
click_button login_button
|
21
21
|
|
22
22
|
visit spree.cart_path
|
23
23
|
expect(page).to have_text 'RoR Mug'
|
@@ -29,7 +29,7 @@ RSpec.feature 'Orders', :js, type: :feature do
|
|
29
29
|
visit spree.login_path
|
30
30
|
fill_in 'Email', with: user.email
|
31
31
|
fill_in 'Password', with: user.password
|
32
|
-
click_button
|
32
|
+
click_button login_button
|
33
33
|
|
34
34
|
# Order should have been merged with first session
|
35
35
|
visit spree.cart_path
|
@@ -13,15 +13,15 @@ RSpec.feature 'Sign In', type: :feature do
|
|
13
13
|
log_in(email: @user.email, password: @user.password)
|
14
14
|
show_user_menu
|
15
15
|
|
16
|
-
expect(page).not_to have_text
|
17
|
-
expect(page).to have_text
|
16
|
+
expect(page).not_to have_text login_button.upcase
|
17
|
+
expect(page).to have_text logout_button.upcase
|
18
18
|
expect(current_path).to eq '/account'
|
19
19
|
end
|
20
20
|
|
21
21
|
scenario 'show validation erros' do
|
22
22
|
fill_in 'Email', with: @user.email
|
23
23
|
fill_in 'Password', with: 'wrong_password'
|
24
|
-
click_button
|
24
|
+
click_button login_button
|
25
25
|
|
26
26
|
expect(page).to have_text 'Invalid email or password'
|
27
27
|
expect(page).to have_text 'Log in'
|
@@ -33,13 +33,14 @@ RSpec.feature 'Sign In', type: :feature do
|
|
33
33
|
|
34
34
|
fill_in 'Email', with: user.email
|
35
35
|
fill_in 'Password', with: user.password
|
36
|
-
click_button 'Log in'
|
37
36
|
|
38
37
|
if Spree.version.to_f > 4.1
|
38
|
+
click_button login_button
|
39
39
|
within '.navbar .dropdown-menu' do
|
40
40
|
expect(page).to have_text 'admin@person.com'
|
41
41
|
end
|
42
42
|
else
|
43
|
+
click_button login_button
|
43
44
|
within '.user-menu' do
|
44
45
|
expect(page).to have_text 'admin@person.com'
|
45
46
|
end
|
@@ -51,7 +52,29 @@ RSpec.feature 'Sign In', type: :feature do
|
|
51
52
|
visit spree.account_path
|
52
53
|
fill_in 'Email', with: @user.email
|
53
54
|
fill_in 'Password', with: @user.password
|
54
|
-
click_button
|
55
|
+
click_button login_button
|
55
56
|
expect(current_path).to eq '/account'
|
56
57
|
end
|
58
|
+
|
59
|
+
context 'localized' do
|
60
|
+
before do
|
61
|
+
if Spree.version.to_f >= 4.2
|
62
|
+
add_french_locales
|
63
|
+
Spree::Store.default.update(default_locale: 'en', supported_locales: 'en,fr')
|
64
|
+
I18n.locale = :fr
|
65
|
+
end
|
66
|
+
end
|
67
|
+
|
68
|
+
after { I18n.locale = :en }
|
69
|
+
|
70
|
+
scenario 'let a user sign in successfully', js: true do
|
71
|
+
skip if Spree.version.to_f < 4.2
|
72
|
+
log_in(email: @user.email, password: @user.password, locale: 'fr')
|
73
|
+
show_user_menu
|
74
|
+
|
75
|
+
expect(page).not_to have_text Spree.t(:login).upcase
|
76
|
+
expect(page).to have_text Spree.t(:logout).upcase
|
77
|
+
expect(current_url).to match(/\/account\?locale\=fr$/)
|
78
|
+
end
|
79
|
+
end
|
57
80
|
end
|
@@ -16,8 +16,8 @@ RSpec.feature 'Sign Out', type: :feature, js: true do
|
|
16
16
|
visit spree.root_path
|
17
17
|
show_user_menu
|
18
18
|
|
19
|
-
expect(page).to have_link
|
20
|
-
expect(page).not_to have_link
|
19
|
+
expect(page).to have_link login_button.upcase
|
20
|
+
expect(page).not_to have_link logout_button.upcase
|
21
21
|
end
|
22
22
|
|
23
23
|
describe 'before_logout' do
|
@@ -22,7 +22,7 @@ RSpec.describe Spree::UserMailer, type: :mailer do
|
|
22
22
|
|
23
23
|
context 'body includes' do
|
24
24
|
it 'password reset url' do
|
25
|
-
expect(@message.body.
|
25
|
+
expect(@message.body.encoded).to include "http://#{store.url}/user/spree_user/password/edit"
|
26
26
|
end
|
27
27
|
end
|
28
28
|
end
|
data/spec/models/user_spec.rb
CHANGED
@@ -65,17 +65,48 @@ RSpec.describe Spree::User, type: :model do
|
|
65
65
|
end
|
66
66
|
end
|
67
67
|
|
68
|
-
describe "confirmable"
|
69
|
-
it "is confirmable if the confirmable option is enabled" do
|
70
|
-
|
71
|
-
Spree::UserMailer.stub(:confirmation_instructions).and_return(double(deliver: true))
|
68
|
+
describe "confirmable" do
|
69
|
+
it "is confirmable if the confirmable option is enabled", confirmable: true do
|
70
|
+
Spree::UserMailer.stub(:confirmation_instructions).with(anything, anything, { current_store_id: Spree::Store.current.id }).and_return(double(deliver: true))
|
72
71
|
expect(Spree.user_class.devise_modules).to include(:confirmable)
|
73
|
-
set_confirmable_option(false)
|
74
72
|
end
|
75
73
|
|
76
|
-
it "is not confirmable if the confirmable option is disabled" do
|
77
|
-
|
78
|
-
|
74
|
+
it "is not confirmable if the confirmable option is disabled", confirmable: false do
|
75
|
+
expect(Spree.user_class.devise_modules).not_to include(:confirmable)
|
76
|
+
end
|
77
|
+
end
|
78
|
+
|
79
|
+
describe "#send_confirmation_instructions", retry: 2 do
|
80
|
+
let(:default_store) { Spree::Store.default }
|
81
|
+
|
82
|
+
context "when current store not exists" do
|
83
|
+
it 'takes default store and sends confirmation instruction', confirmable: true do
|
84
|
+
user = Spree.user_class.new
|
85
|
+
user.email = FFaker::Internet.email
|
86
|
+
user.password = user.password_confirmation = 'pass1234'
|
87
|
+
user.save
|
88
|
+
|
89
|
+
expect(Spree::UserMailer).to receive(:confirmation_instructions).with(
|
90
|
+
user, anything, { current_store_id: default_store.id }).and_return(double(deliver: true)
|
91
|
+
)
|
92
|
+
|
93
|
+
user.send_confirmation_instructions(nil)
|
94
|
+
end
|
95
|
+
end
|
96
|
+
|
97
|
+
context "when current store exists" do
|
98
|
+
it 'takes current store and sends confirmation instruction', confirmable: true do
|
99
|
+
user = Spree.user_class.new
|
100
|
+
user.email = FFaker::Internet.email
|
101
|
+
user.password = user.password_confirmation = 'pass1234'
|
102
|
+
user.save
|
103
|
+
|
104
|
+
expect(Spree::UserMailer).to receive(:confirmation_instructions).with(
|
105
|
+
user, anything, { current_store_id: store.id }).and_return(double(deliver: true)
|
106
|
+
)
|
107
|
+
|
108
|
+
user.send_confirmation_instructions(store)
|
109
|
+
end
|
79
110
|
end
|
80
111
|
end
|
81
112
|
end
|
data/spec/spec_helper.rb
CHANGED
@@ -9,10 +9,14 @@ require 'spree_dev_tools/rspec/spec_helper'
|
|
9
9
|
# in spec/support/ and its subdirectories.
|
10
10
|
Dir[File.join(File.dirname(__FILE__), 'support/**/*.rb')].sort.each { |f| require f }
|
11
11
|
|
12
|
+
require 'spree/testing_support/locale_helpers' if Spree.version.to_f >= 4.2
|
13
|
+
|
12
14
|
RSpec.configure do |config|
|
13
15
|
config.before(:each) do
|
14
16
|
allow(RSpec::Rails::ViewRendering::EmptyTemplateHandler)
|
15
17
|
.to receive(:call)
|
16
18
|
.and_return(%("")) if Rails.gem_version >= Gem::Version.new('6.0.0.beta1')
|
17
19
|
end
|
20
|
+
|
21
|
+
config.include Spree::TestingSupport::LocaleHelpers if defined?(Spree::TestingSupport::LocaleHelpers)
|
18
22
|
end
|
@@ -1,11 +1,24 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
1
|
+
RSpec.configure do |config|
|
2
|
+
config.around do |example|
|
3
|
+
if example.metadata.key?(:confirmable)
|
4
|
+
old_user = Spree::User
|
5
|
+
|
6
|
+
begin
|
7
|
+
example.run
|
8
|
+
ensure
|
9
|
+
Spree.const_set('User', old_user)
|
10
|
+
end
|
11
|
+
else
|
12
|
+
example.run
|
13
|
+
end
|
6
14
|
end
|
7
|
-
end
|
8
15
|
|
9
|
-
|
10
|
-
|
16
|
+
config.before do |example|
|
17
|
+
if example.metadata.key?(:confirmable)
|
18
|
+
Spree::Auth::Config[:confirmable] = example.metadata[:confirmable]
|
19
|
+
|
20
|
+
Spree.send(:remove_const, :User)
|
21
|
+
load File.expand_path('../../../app/models/spree/user.rb', __FILE__)
|
22
|
+
end
|
23
|
+
end
|
11
24
|
end
|
data/spree_auth_devise.gemspec
CHANGED
@@ -1,26 +1,35 @@
|
|
1
1
|
# encoding: UTF-8
|
2
|
+
lib = File.expand_path('../lib/', __FILE__)
|
3
|
+
$LOAD_PATH.unshift lib unless $LOAD_PATH.include?(lib)
|
4
|
+
|
5
|
+
require 'spree/auth/version'
|
2
6
|
|
3
7
|
Gem::Specification.new do |s|
|
4
8
|
s.platform = Gem::Platform::RUBY
|
5
9
|
s.name = 'spree_auth_devise'
|
6
|
-
s.version =
|
10
|
+
s.version = Spree::Auth::VERSION
|
7
11
|
s.summary = 'Provides authentication and authorization services for use with Spree by using Devise and CanCan.'
|
8
12
|
s.description = s.summary
|
9
13
|
|
10
14
|
s.required_ruby_version = '>= 2.5.0'
|
11
15
|
|
12
|
-
s.
|
13
|
-
s.email = '
|
16
|
+
s.authors = ['Sean Schofield', 'Spark Solutions']
|
17
|
+
s.email = 'hello@spreecommerce.org'
|
14
18
|
s.homepage = 'https://spreecommerce.org'
|
15
19
|
s.license = 'BSD-3-Clause'
|
16
20
|
|
21
|
+
s.metadata = {
|
22
|
+
"bug_tracker_uri" => "https://github.com/spree/spree_auth_devise/issues",
|
23
|
+
"changelog_uri" => "https://github.com/spree/spree_auth_devise/releases/tag/v#{s.version}",
|
24
|
+
"documentation_uri" => "https://guides.spreecommerce.org/",
|
25
|
+
"source_code_uri" => "https://github.com/spree/spree_auth_devise/tree/v#{s.version}",
|
26
|
+
}
|
27
|
+
|
17
28
|
s.files = `git ls-files`.split("\n")
|
18
29
|
s.test_files = `git ls-files -- spec/*`.split("\n")
|
19
30
|
s.require_path = 'lib'
|
20
31
|
s.requirements << 'none'
|
21
32
|
|
22
|
-
s.add_dependency 'deface', '~> 1.0'
|
23
|
-
|
24
33
|
s.add_dependency 'devise', '~> 4.7'
|
25
34
|
s.add_dependency 'devise-encryptable', '0.2.0'
|
26
35
|
|
metadata
CHANGED
@@ -1,29 +1,16 @@
|
|
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.3.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sean Schofield
|
8
|
+
- Spark Solutions
|
8
9
|
autorequire:
|
9
10
|
bindir: bin
|
10
11
|
cert_chain: []
|
11
|
-
date:
|
12
|
+
date: 2021-02-24 00:00:00.000000000 Z
|
12
13
|
dependencies:
|
13
|
-
- !ruby/object:Gem::Dependency
|
14
|
-
name: deface
|
15
|
-
requirement: !ruby/object:Gem::Requirement
|
16
|
-
requirements:
|
17
|
-
- - "~>"
|
18
|
-
- !ruby/object:Gem::Version
|
19
|
-
version: '1.0'
|
20
|
-
type: :runtime
|
21
|
-
prerelease: false
|
22
|
-
version_requirements: !ruby/object:Gem::Requirement
|
23
|
-
requirements:
|
24
|
-
- - "~>"
|
25
|
-
- !ruby/object:Gem::Version
|
26
|
-
version: '1.0'
|
27
14
|
- !ruby/object:Gem::Dependency
|
28
15
|
name: devise
|
29
16
|
requirement: !ruby/object:Gem::Requirement
|
@@ -102,12 +89,13 @@ dependencies:
|
|
102
89
|
version: '0'
|
103
90
|
description: Provides authentication and authorization services for use with Spree
|
104
91
|
by using Devise and CanCan.
|
105
|
-
email:
|
92
|
+
email: hello@spreecommerce.org
|
106
93
|
executables: []
|
107
94
|
extensions: []
|
108
95
|
extra_rdoc_files: []
|
109
96
|
files:
|
110
97
|
- ".circleci/config.yml"
|
98
|
+
- ".gem_release.yml"
|
111
99
|
- ".gitignore"
|
112
100
|
- ".rspec"
|
113
101
|
- ".travis.yml"
|
@@ -127,10 +115,11 @@ files:
|
|
127
115
|
- app/mailers/spree/user_mailer.rb
|
128
116
|
- app/models/spree/auth_configuration.rb
|
129
117
|
- app/models/spree/user.rb
|
130
|
-
- app/overrides/spree/admin/shared/_header/auth_admin_login_navigation_bar.html.erb.deface
|
131
118
|
- app/services/spree/account/create.rb
|
132
119
|
- app/services/spree/account/update.rb
|
120
|
+
- app/views/spree/user_mailer/confirmation_instructions.html.erb
|
133
121
|
- app/views/spree/user_mailer/confirmation_instructions.text.erb
|
122
|
+
- app/views/spree/user_mailer/reset_password_instructions.html.erb
|
134
123
|
- app/views/spree/user_mailer/reset_password_instructions.text.erb
|
135
124
|
- app/views/spree/user_passwords/edit.html.erb
|
136
125
|
- app/views/spree/user_passwords/new.html.erb
|
@@ -178,6 +167,7 @@ files:
|
|
178
167
|
- lib/spree/auth.rb
|
179
168
|
- lib/spree/auth/devise.rb
|
180
169
|
- lib/spree/auth/engine.rb
|
170
|
+
- lib/spree/auth/version.rb
|
181
171
|
- lib/spree/authentication_helpers.rb
|
182
172
|
- lib/spree/testing_support/auth_helpers.rb
|
183
173
|
- lib/spree/testing_support/checkout_helpers.rb
|
@@ -226,12 +216,15 @@ files:
|
|
226
216
|
- spec/support/configuration_helpers.rb
|
227
217
|
- spec/support/confirm_helpers.rb
|
228
218
|
- spec/support/email.rb
|
229
|
-
- spec/support/user_helper.rb
|
230
219
|
- spree_auth_devise.gemspec
|
231
220
|
homepage: https://spreecommerce.org
|
232
221
|
licenses:
|
233
222
|
- BSD-3-Clause
|
234
|
-
metadata:
|
223
|
+
metadata:
|
224
|
+
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
|
226
|
+
documentation_uri: https://guides.spreecommerce.org/
|
227
|
+
source_code_uri: https://github.com/spree/spree_auth_devise/tree/v4.3.4
|
235
228
|
post_install_message:
|
236
229
|
rdoc_options: []
|
237
230
|
require_paths:
|
@@ -248,7 +241,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
248
241
|
version: '0'
|
249
242
|
requirements:
|
250
243
|
- none
|
251
|
-
rubygems_version: 3.
|
244
|
+
rubygems_version: 3.2.3
|
252
245
|
signing_key:
|
253
246
|
specification_version: 4
|
254
247
|
summary: Provides authentication and authorization services for use with Spree by
|
@@ -289,4 +282,3 @@ test_files:
|
|
289
282
|
- spec/support/configuration_helpers.rb
|
290
283
|
- spec/support/confirm_helpers.rb
|
291
284
|
- spec/support/email.rb
|
292
|
-
- spec/support/user_helper.rb
|
data/spec/support/user_helper.rb
DELETED