solidus_auth_devise 2.1.0 → 2.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.circleci/config.yml +35 -0
- data/.gem_release.yml +10 -0
- data/.travis.yml +8 -14
- data/CHANGELOG.md +16 -0
- data/Gemfile +13 -5
- data/README.md +30 -3
- data/app/models/spree/user.rb +4 -0
- data/config/initializers/devise.rb +0 -3
- data/config/locales/en.yml +1 -0
- data/config/locales/fr.yml +1 -1
- data/config/routes.rb +3 -1
- data/db/migrate/20101026184950_rename_columns_for_devise.rb +0 -1
- data/db/migrate/20190125170630_add_reset_password_token_index_to_spree_users.rb +32 -0
- data/lib/controllers/backend/spree/admin/user_passwords_controller.rb +2 -0
- data/lib/controllers/backend/spree/admin/user_sessions_controller.rb +2 -2
- data/lib/controllers/frontend/spree/user_sessions_controller.rb +2 -2
- data/lib/controllers/frontend/spree/users_controller.rb +5 -3
- data/lib/generators/solidus/auth/install/templates/config/initializers/devise.rb +1 -1
- data/lib/spree/auth/engine.rb +2 -2
- data/lib/spree/auth/version.rb +7 -0
- data/lib/views/backend/spree/admin/shared/_navigation_footer.html.erb +12 -5
- data/lib/views/backend/spree/admin/user_passwords/edit.html.erb +4 -4
- data/lib/views/backend/spree/admin/user_passwords/new.html.erb +4 -4
- data/lib/views/backend/spree/admin/user_sessions/authorization_failure.html.erb +1 -1
- data/lib/views/backend/spree/admin/user_sessions/new.html.erb +7 -7
- data/lib/views/backend/spree/layouts/admin/_login_nav.html.erb +4 -4
- data/lib/views/frontend/spree/checkout/registration.html.erb +4 -4
- data/lib/views/frontend/spree/shared/_login.html.erb +4 -4
- data/lib/views/frontend/spree/shared/_login_bar_items.html.erb +3 -3
- data/lib/views/frontend/spree/shared/_user_form.html.erb +3 -3
- data/lib/views/frontend/spree/user_passwords/edit.html.erb +4 -4
- data/lib/views/frontend/spree/user_passwords/new.html.erb +4 -4
- data/lib/views/frontend/spree/user_registrations/new.html.erb +3 -3
- data/lib/views/frontend/spree/user_sessions/authorization_failure.html.erb +1 -1
- data/lib/views/frontend/spree/user_sessions/new.html.erb +2 -2
- data/lib/views/frontend/spree/users/edit.html.erb +2 -2
- data/lib/views/frontend/spree/users/show.html.erb +12 -12
- data/solidus_auth_devise.gemspec +6 -3
- data/spec/controllers/spree/admin/user_passwords_controller_spec.rb +12 -0
- data/spec/controllers/spree/checkout_controller_spec.rb +1 -1
- data/spec/controllers/spree/users_controller_spec.rb +25 -7
- data/spec/factories/confirmed_user.rb +1 -1
- data/spec/features/confirmation_spec.rb +4 -9
- data/spec/models/user_spec.rb +1 -3
- data/spec/support/confirm_helpers.rb +7 -5
- metadata +22 -18
- data/circle.yml +0 -6
- data/lib/controllers/backend/spree/admin/admin_orders_controller_decorator.rb +0 -20
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 559c61d1fca6c80b947025f147de804bfe73a19ee9bd5f4066c2691f3db98dab
|
|
4
|
+
data.tar.gz: 7de599e4f661d0265a073f9c9abe2243ed443fb5b47aaa39c2e049461afaff48
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 13f6f1323ae7d1c5fbbf7f7c02b491640a82b2b0ebfff418e11738d5161764a190673cd702ed9fef907e8d3f6e30bde15cd1b621a9ea22ac1d2f513f707dbf86
|
|
7
|
+
data.tar.gz: 511c01da048f75ad730af1ef56ad65b64f26483b846ddad7b1976dc7d2e51bbe57d05d61776633be9704ceac8cbff4dbdff1d7401cc04708f1fa319d65d8f1b7
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
version: 2.1
|
|
2
|
+
|
|
3
|
+
orbs:
|
|
4
|
+
# Always take the latest version of the orb, this allows us to
|
|
5
|
+
# run specs against Solidus supported versions only without the need
|
|
6
|
+
# to change this configuration every time a Solidus version is released
|
|
7
|
+
# or goes EOL.
|
|
8
|
+
solidusio_extensions: solidusio/extensions@volatile
|
|
9
|
+
|
|
10
|
+
jobs:
|
|
11
|
+
run-specs-with-postgres:
|
|
12
|
+
executor: solidusio_extensions/postgres
|
|
13
|
+
steps:
|
|
14
|
+
- solidusio_extensions/run-tests
|
|
15
|
+
run-specs-with-mysql:
|
|
16
|
+
executor: solidusio_extensions/mysql
|
|
17
|
+
steps:
|
|
18
|
+
- solidusio_extensions/run-tests
|
|
19
|
+
|
|
20
|
+
workflows:
|
|
21
|
+
"Run specs on supported Solidus versions":
|
|
22
|
+
jobs:
|
|
23
|
+
- run-specs-with-postgres
|
|
24
|
+
- run-specs-with-mysql
|
|
25
|
+
"Weekly run specs against master":
|
|
26
|
+
triggers:
|
|
27
|
+
- schedule:
|
|
28
|
+
cron: "0 0 * * 4" # every Thursday
|
|
29
|
+
filters:
|
|
30
|
+
branches:
|
|
31
|
+
only:
|
|
32
|
+
- master
|
|
33
|
+
jobs:
|
|
34
|
+
- run-specs-with-postgres
|
|
35
|
+
- run-specs-with-mysql
|
data/.gem_release.yml
ADDED
data/.travis.yml
CHANGED
|
@@ -4,21 +4,15 @@ rvm:
|
|
|
4
4
|
- 2.3.1
|
|
5
5
|
env:
|
|
6
6
|
matrix:
|
|
7
|
-
- SOLIDUS_BRANCH=v1.2 DB=postgres
|
|
8
|
-
- SOLIDUS_BRANCH=v1.3 DB=postgres
|
|
9
|
-
- SOLIDUS_BRANCH=v1.4 DB=postgres
|
|
10
|
-
- SOLIDUS_BRANCH=v2.0 DB=postgres
|
|
11
|
-
- SOLIDUS_BRANCH=v2.1 DB=postgres
|
|
12
|
-
- SOLIDUS_BRANCH=v2.2 DB=postgres
|
|
13
|
-
- SOLIDUS_BRANCH=v2.3 DB=postgres
|
|
14
7
|
- SOLIDUS_BRANCH=v2.4 DB=postgres
|
|
8
|
+
- SOLIDUS_BRANCH=v2.5 DB=postgres
|
|
9
|
+
- SOLIDUS_BRANCH=v2.6 DB=postgres
|
|
10
|
+
- SOLIDUS_BRANCH=v2.7 DB=postgres
|
|
11
|
+
- SOLIDUS_BRANCH=v2.8 DB=postgres
|
|
15
12
|
- SOLIDUS_BRANCH=master DB=postgres
|
|
16
|
-
- SOLIDUS_BRANCH=v1.2 DB=mysql
|
|
17
|
-
- SOLIDUS_BRANCH=v1.3 DB=mysql
|
|
18
|
-
- SOLIDUS_BRANCH=v1.4 DB=mysql
|
|
19
|
-
- SOLIDUS_BRANCH=v2.0 DB=mysql
|
|
20
|
-
- SOLIDUS_BRANCH=v2.1 DB=mysql
|
|
21
|
-
- SOLIDUS_BRANCH=v2.2 DB=mysql
|
|
22
|
-
- SOLIDUS_BRANCH=v2.3 DB=mysql
|
|
23
13
|
- SOLIDUS_BRANCH=v2.4 DB=mysql
|
|
14
|
+
- SOLIDUS_BRANCH=v2.5 DB=mysql
|
|
15
|
+
- SOLIDUS_BRANCH=v2.6 DB=mysql
|
|
16
|
+
- SOLIDUS_BRANCH=v2.7 DB=mysql
|
|
17
|
+
- SOLIDUS_BRANCH=v2.8 DB=mysql
|
|
24
18
|
- SOLIDUS_BRANCH=master DB=mysql
|
data/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,21 @@
|
|
|
1
1
|
## Master (unreleased)
|
|
2
2
|
|
|
3
|
+
## Solidus Auth Devise v2.2.0 (2019-06-13)
|
|
4
|
+
|
|
5
|
+
* Add DB index to `reset_password_token` field
|
|
6
|
+
* Add missing pessimistic versioning
|
|
7
|
+
* Add missing translation to `spree.change_my_password`
|
|
8
|
+
* Allow Spree::Admin::UserPasswordsController to be accessed from admin
|
|
9
|
+
* Disable backend footer profile edit link if role cannot edit users
|
|
10
|
+
* Fix issue with redirections using routes like `new_spree_user_session_url`
|
|
11
|
+
* Fix migration `20101026184950` `down` method
|
|
12
|
+
* Fix to not reuse spree_current_user as `@user`
|
|
13
|
+
* Replace Spree.t with I18n.t
|
|
14
|
+
* Lock mysql2 to 0.4.x
|
|
15
|
+
* Lock SQLite3 to version 1.3
|
|
16
|
+
* Remove FactoryBot warnings
|
|
17
|
+
* Configure CI to ensure support on ruby 2.3 + Solidus 2.4 - 2.8
|
|
18
|
+
|
|
3
19
|
## Solidus Auth Devise v2.1.0 (2018-01-22)
|
|
4
20
|
|
|
5
21
|
* Avoid requiring deface on Solidus 2.5+.
|
data/Gemfile
CHANGED
|
@@ -5,19 +5,27 @@ gem "solidus", github: "solidusio/solidus", branch: branch
|
|
|
5
5
|
|
|
6
6
|
group :test do
|
|
7
7
|
if branch == 'master' || branch >= "v2.0"
|
|
8
|
-
gem
|
|
8
|
+
gem 'rails-controller-testing', '~> 1.0'
|
|
9
9
|
else
|
|
10
10
|
gem "rails_test_params_backport"
|
|
11
11
|
end
|
|
12
|
+
if branch < "v2.5"
|
|
13
|
+
gem 'factory_bot', '4.10.0'
|
|
14
|
+
else
|
|
15
|
+
gem 'factory_bot', '> 4.10.0'
|
|
16
|
+
end
|
|
12
17
|
end
|
|
13
18
|
|
|
14
|
-
|
|
15
|
-
gem 'mysql2'
|
|
19
|
+
if ENV['DB'] == 'mysql'
|
|
20
|
+
gem 'mysql2', '~> 0.4.10'
|
|
21
|
+
else
|
|
22
|
+
gem 'pg', '~> 0.21'
|
|
23
|
+
end
|
|
16
24
|
|
|
17
25
|
group :development, :test do
|
|
18
|
-
gem
|
|
26
|
+
gem 'pry-rails', '~> 0.3.9'
|
|
19
27
|
end
|
|
20
28
|
|
|
21
|
-
gem 'deface', require: false
|
|
29
|
+
gem 'deface', '~> 1.3', require: false
|
|
22
30
|
|
|
23
31
|
gemspec
|
data/README.md
CHANGED
|
@@ -46,9 +46,6 @@ Devise.setup do |config|
|
|
|
46
46
|
# Required so users don't lose their carts when they need to confirm.
|
|
47
47
|
config.allow_unconfirmed_access_for = 1.days
|
|
48
48
|
|
|
49
|
-
# Fixes the bug where Confirmation errors result in a broken page.
|
|
50
|
-
config.router_name = :spree
|
|
51
|
-
|
|
52
49
|
# Add any other devise configurations here, as they will override the defaults provided by solidus_auth_devise.
|
|
53
50
|
end
|
|
54
51
|
```
|
|
@@ -96,3 +93,33 @@ Run the following to automatically build a dummy app if necessary and run the te
|
|
|
96
93
|
```shell
|
|
97
94
|
bundle exec rake
|
|
98
95
|
```
|
|
96
|
+
|
|
97
|
+
Releasing
|
|
98
|
+
---------
|
|
99
|
+
|
|
100
|
+
We use [gem-release](https://github.com/svenfuchs/gem-release) to release this
|
|
101
|
+
extension with ease.
|
|
102
|
+
|
|
103
|
+
Supposing you are on the master branch and you are working on a fork of this
|
|
104
|
+
extension, `upstream` is the main remote and you have write access to it, you
|
|
105
|
+
can simply run:
|
|
106
|
+
|
|
107
|
+
```
|
|
108
|
+
gem bump --version minor --tag --release
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
This command will:
|
|
112
|
+
|
|
113
|
+
- bump the gem version to the next minor (changing the `version.rb` file)
|
|
114
|
+
- commit the change and push it to upstream master
|
|
115
|
+
- create a git tag
|
|
116
|
+
- push the tag to the upstream remote
|
|
117
|
+
- release the new version on RubyGems
|
|
118
|
+
|
|
119
|
+
Or you can run these commands individually:
|
|
120
|
+
|
|
121
|
+
```
|
|
122
|
+
gem bump --version minor
|
|
123
|
+
gem tag
|
|
124
|
+
gem release
|
|
125
|
+
```
|
data/app/models/spree/user.rb
CHANGED
data/config/locales/en.yml
CHANGED
data/config/locales/fr.yml
CHANGED
|
@@ -46,5 +46,5 @@ fr:
|
|
|
46
46
|
not_found: "n'a pas été trouvé"
|
|
47
47
|
not_locked: "n'a pas été bloqué"
|
|
48
48
|
not_saved:
|
|
49
|
-
one: "1 erreur interdit cette %{
|
|
49
|
+
one: "1 erreur interdit cette %{resource} d'être enregistrée :"
|
|
50
50
|
other: "%{count} erreurs interdisent cette %{resource} d'être enregistrée :"
|
data/config/routes.rb
CHANGED
|
@@ -14,7 +14,8 @@ Spree::Core::Engine.routes.draw do
|
|
|
14
14
|
},
|
|
15
15
|
skip: [:unlocks, :omniauth_callbacks],
|
|
16
16
|
path_names: { sign_out: 'logout' },
|
|
17
|
-
path_prefix: :user
|
|
17
|
+
path_prefix: :user,
|
|
18
|
+
router_name: :spree
|
|
18
19
|
})
|
|
19
20
|
|
|
20
21
|
resources :users, only: [:edit, :update]
|
|
@@ -53,6 +54,7 @@ Spree::Core::Engine.routes.draw do
|
|
|
53
54
|
sessions: 'spree/admin/user_sessions',
|
|
54
55
|
passwords: 'spree/admin/user_passwords'
|
|
55
56
|
},
|
|
57
|
+
router_name: :spree
|
|
56
58
|
})
|
|
57
59
|
|
|
58
60
|
devise_scope :spree_user do
|
|
@@ -31,7 +31,6 @@ class RenameColumnsForDevise < SolidusSupport::Migration[4.2]
|
|
|
31
31
|
rename_column :spree_users, :remember_created_at, :remember_token_expires_at
|
|
32
32
|
rename_column :spree_users, :password_salt, :salt
|
|
33
33
|
rename_column :spree_users, :encrypted_password, :crypted_password
|
|
34
|
-
add_column :spree_users, :unlock_token, :string
|
|
35
34
|
add_column :spree_users, :openid_identifier, :string
|
|
36
35
|
end
|
|
37
36
|
end
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
class AddResetPasswordTokenIndexToSpreeUsers < SolidusSupport::Migration[4.2]
|
|
2
|
+
# We're not using the standard Rails index name because somebody could have
|
|
3
|
+
# already added that index to the table. By using a custom name we ensure
|
|
4
|
+
# that the index can effectively be added and removed via migrations/rollbacks
|
|
5
|
+
# without having any impact on such installations. The index name is Rails
|
|
6
|
+
# standard name + "_solidus_auth_devise"; the length is 61 chars which is
|
|
7
|
+
# still OK for Sqlite, mySQL and Postgres.
|
|
8
|
+
def custom_index_name
|
|
9
|
+
'index_spree_users_on_reset_password_token_solidus_auth_devise'
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
def default_index_exists?
|
|
13
|
+
index_exists?(:spree_users, :reset_password_token)
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
def custom_index_exists?
|
|
17
|
+
index_exists?(:spree_users, :reset_password_token, name: custom_index_name)
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
def up
|
|
21
|
+
Spree::User.reset_column_information
|
|
22
|
+
if Spree::User.column_names.include?('reset_password_token') && !default_index_exists? && !custom_index_exists?
|
|
23
|
+
add_index :spree_users, :reset_password_token, unique: true, name: custom_index_name
|
|
24
|
+
end
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
def down
|
|
28
|
+
if custom_index_exists?
|
|
29
|
+
remove_index :spree_users, name: custom_index_name
|
|
30
|
+
end
|
|
31
|
+
end
|
|
32
|
+
end
|
|
@@ -8,6 +8,8 @@ class Spree::Admin::UserPasswordsController < Devise::PasswordsController
|
|
|
8
8
|
helper 'spree/admin/navigation'
|
|
9
9
|
layout 'spree/layouts/admin'
|
|
10
10
|
|
|
11
|
+
skip_before_action :require_no_authentication, only: [:create]
|
|
12
|
+
|
|
11
13
|
# Overridden due to bug in Devise.
|
|
12
14
|
# respond_with resource, location: new_session_path(resource_name)
|
|
13
15
|
# is generating bad url /session/new.user
|
|
@@ -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] =
|
|
17
|
+
flash[:success] = I18n.t('spree.logged_in_succesfully')
|
|
18
18
|
redirect_back_or_default(after_sign_in_path_for(spree_current_user))
|
|
19
19
|
}
|
|
20
20
|
format.js {
|
|
@@ -33,7 +33,7 @@ class Spree::Admin::UserSessionsController < Devise::SessionsController
|
|
|
33
33
|
|
|
34
34
|
private
|
|
35
35
|
def accurate_title
|
|
36
|
-
|
|
36
|
+
I18n.t('spree.login')
|
|
37
37
|
end
|
|
38
38
|
|
|
39
39
|
def redirect_back_or_default(default)
|
|
@@ -16,7 +16,7 @@ class Spree::UserSessionsController < Devise::SessionsController
|
|
|
16
16
|
if spree_user_signed_in?
|
|
17
17
|
respond_to do |format|
|
|
18
18
|
format.html do
|
|
19
|
-
flash[:success] =
|
|
19
|
+
flash[:success] = I18n.t('spree.logged_in_succesfully')
|
|
20
20
|
redirect_back_or_default(after_sign_in_path_for(spree_current_user))
|
|
21
21
|
end
|
|
22
22
|
format.js { render success_json }
|
|
@@ -44,7 +44,7 @@ class Spree::UserSessionsController < Devise::SessionsController
|
|
|
44
44
|
private
|
|
45
45
|
|
|
46
46
|
def accurate_title
|
|
47
|
-
|
|
47
|
+
I18n.t('spree.login')
|
|
48
48
|
end
|
|
49
49
|
|
|
50
50
|
def redirect_back_or_default(default)
|
|
@@ -25,13 +25,15 @@ class Spree::UsersController < Spree::StoreController
|
|
|
25
25
|
|
|
26
26
|
def update
|
|
27
27
|
if @user.update_attributes(user_params)
|
|
28
|
+
spree_current_user.reload
|
|
29
|
+
|
|
28
30
|
if params[:user][:password].present?
|
|
29
31
|
# this logic needed b/c devise wants to log us out after password changes
|
|
30
32
|
unless Spree::Auth::Config[:signout_after_password_change]
|
|
31
33
|
bypass_sign_in(@user)
|
|
32
34
|
end
|
|
33
35
|
end
|
|
34
|
-
redirect_to spree.account_url, notice:
|
|
36
|
+
redirect_to spree.account_url, notice: I18n.t('spree.account_updated')
|
|
35
37
|
else
|
|
36
38
|
render :edit
|
|
37
39
|
end
|
|
@@ -43,7 +45,7 @@ class Spree::UsersController < Spree::StoreController
|
|
|
43
45
|
end
|
|
44
46
|
|
|
45
47
|
def load_object
|
|
46
|
-
@user ||= spree_current_user
|
|
48
|
+
@user ||= Spree::User.find_by(id: spree_current_user&.id)
|
|
47
49
|
authorize! params[:action].to_sym, @user
|
|
48
50
|
end
|
|
49
51
|
|
|
@@ -52,6 +54,6 @@ class Spree::UsersController < Spree::StoreController
|
|
|
52
54
|
end
|
|
53
55
|
|
|
54
56
|
def accurate_title
|
|
55
|
-
|
|
57
|
+
I18n.t('spree.my_account')
|
|
56
58
|
end
|
|
57
59
|
end
|
|
@@ -1 +1 @@
|
|
|
1
|
-
Devise.secret_key =
|
|
1
|
+
Devise.secret_key = SecureRandom.hex(50).inspect
|
data/lib/spree/auth/engine.rb
CHANGED
|
@@ -36,7 +36,7 @@ module Spree
|
|
|
36
36
|
|
|
37
37
|
Spree::Admin::BaseController.unauthorized_redirect = -> do
|
|
38
38
|
if try_spree_current_user
|
|
39
|
-
flash[:error] =
|
|
39
|
+
flash[:error] = I18n.t('spree.authorization_failure')
|
|
40
40
|
redirect_to spree.admin_unauthorized_path
|
|
41
41
|
else
|
|
42
42
|
store_location
|
|
@@ -57,7 +57,7 @@ module Spree
|
|
|
57
57
|
|
|
58
58
|
Spree::BaseController.unauthorized_redirect = -> do
|
|
59
59
|
if try_spree_current_user
|
|
60
|
-
flash[:error] =
|
|
60
|
+
flash[:error] = I18n.t('spree.authorization_failure')
|
|
61
61
|
redirect_to spree.unauthorized_path
|
|
62
62
|
else
|
|
63
63
|
store_location
|
|
@@ -1,15 +1,22 @@
|
|
|
1
1
|
<% if spree_current_user %>
|
|
2
2
|
<ul id="login-nav" class="admin-login-nav">
|
|
3
3
|
<li data-hook="user-account-link">
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
4
|
+
<% if can?(:admin, try_spree_current_user) %>
|
|
5
|
+
<%= link_to spree.edit_admin_user_path(try_spree_current_user) do %>
|
|
6
|
+
<i class='fa fa-user'></i>
|
|
7
|
+
<%= try_spree_current_user.email %>
|
|
8
|
+
<% end %>
|
|
9
|
+
<% else %>
|
|
10
|
+
<a>
|
|
11
|
+
<i class='fa fa-user'></i>
|
|
12
|
+
<%= try_spree_current_user.email %>
|
|
13
|
+
</a>
|
|
7
14
|
<% end %>
|
|
8
15
|
</li>
|
|
9
16
|
<li data-hook="user-logout-link">
|
|
10
17
|
<%= link_to spree.admin_logout_path do %>
|
|
11
18
|
<i class='fa fa-sign-out'></i>
|
|
12
|
-
<%=
|
|
19
|
+
<%= I18n.t('spree.logout') %>
|
|
13
20
|
<% end %>
|
|
14
21
|
</li>
|
|
15
22
|
|
|
@@ -17,7 +24,7 @@
|
|
|
17
24
|
<li data-hook="store-frontend-link">
|
|
18
25
|
<%= link_to spree.root_path, target: '_blank' do %>
|
|
19
26
|
<i class='fa fa-external-link'></i>
|
|
20
|
-
<%=
|
|
27
|
+
<%= I18n.t('spree.back_to_store') %>
|
|
21
28
|
<% end %>
|
|
22
29
|
</li>
|
|
23
30
|
<% end %>
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
<%= render partial: 'spree/shared/error_messages', locals: { target: @spree_user } %>
|
|
2
|
-
<h2><%=
|
|
2
|
+
<h2><%= I18n.t('spree.change_my_password') %></h2>
|
|
3
3
|
|
|
4
4
|
<%= form_for @spree_user, as: :spree_user, url: spree.update_password_path, method: :put do |f| %>
|
|
5
5
|
<p>
|
|
6
|
-
<%= f.label :password,
|
|
6
|
+
<%= f.label :password, I18n.t('spree.password') %><br />
|
|
7
7
|
<%= f.password_field :password %><br />
|
|
8
8
|
</p>
|
|
9
9
|
<p>
|
|
10
|
-
<%= f.label :password_confirmation,
|
|
10
|
+
<%= f.label :password_confirmation, I18n.t('spree.confirm_password') %><br />
|
|
11
11
|
<%= f.password_field :password_confirmation %><br />
|
|
12
12
|
</p>
|
|
13
13
|
<%= f.hidden_field :reset_password_token %>
|
|
14
|
-
<%= f.submit
|
|
14
|
+
<%= f.submit I18n.t('spree.update'), class: 'button primary' %>
|
|
15
15
|
<% end %>
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
<%= render partial: 'spree/shared/error_messages', locals: { target: @spree_user } %>
|
|
2
2
|
|
|
3
3
|
<div id="forgot-password">
|
|
4
|
-
<h6><%=
|
|
4
|
+
<h6><%= I18n.t('spree.forgot_password') %></h6>
|
|
5
5
|
|
|
6
|
-
<p><%=
|
|
6
|
+
<p><%= I18n.t('spree.instructions_to_reset_password') %></p>
|
|
7
7
|
|
|
8
8
|
<%= form_for Spree::User.new, as: :spree_user, url: spree.admin_reset_password_path do |f| %>
|
|
9
9
|
<p>
|
|
10
|
-
<%= f.label :email,
|
|
10
|
+
<%= f.label :email, I18n.t('spree.email') %><br />
|
|
11
11
|
<%= f.email_field :email %>
|
|
12
12
|
</p>
|
|
13
13
|
<p>
|
|
14
|
-
<%= f.submit
|
|
14
|
+
<%= f.submit I18n.t('spree.reset_password'), class: 'button primary' %>
|
|
15
15
|
</p>
|
|
16
16
|
<% end %>
|
|
17
17
|
</div>
|
|
@@ -4,28 +4,28 @@
|
|
|
4
4
|
|
|
5
5
|
<% @body_id = 'login' %>
|
|
6
6
|
<div id="existing-customer">
|
|
7
|
-
<h6><%=
|
|
7
|
+
<h6><%= I18n.t('spree.admin_login') %></h6>
|
|
8
8
|
<div data-hook="login">
|
|
9
9
|
<%= form_for Spree::User.new, as: :spree_user, url: spree.admin_create_new_session_path do |f| %>
|
|
10
10
|
<div id="password-credentials">
|
|
11
11
|
<p>
|
|
12
|
-
<%= f.label :email,
|
|
12
|
+
<%= f.label :email, I18n.t('spree.email') %><br />
|
|
13
13
|
<%= f.email_field :email, class: 'title', tabindex: 1 %>
|
|
14
14
|
</p>
|
|
15
15
|
<p>
|
|
16
|
-
<%= f.label :password,
|
|
16
|
+
<%= f.label :password, I18n.t('spree.password') %><br />
|
|
17
17
|
<%= f.password_field :password, class: 'title', tabindex: 2 %>
|
|
18
18
|
</p>
|
|
19
19
|
</div>
|
|
20
20
|
<p>
|
|
21
21
|
<%= f.check_box :remember_me, tabindex: 3 %>
|
|
22
|
-
<%= f.label :remember_me,
|
|
22
|
+
<%= f.label :remember_me, I18n.t('spree.remember_me') %>
|
|
23
23
|
</p>
|
|
24
24
|
|
|
25
|
-
<p><%= f.submit
|
|
25
|
+
<p><%= f.submit I18n.t('spree.login'), class: 'button primary', tabindex: 4 %></p>
|
|
26
26
|
<% end %>
|
|
27
|
-
<%=
|
|
28
|
-
<%= link_to
|
|
27
|
+
<%= I18n.t('spree.or') %>
|
|
28
|
+
<%= link_to I18n.t('spree.forgot_password'), spree.admin_recover_password_path %>
|
|
29
29
|
</div>
|
|
30
30
|
</div>
|
|
31
31
|
<div data-hook="login_extras"></div>
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
<% if spree_current_user %>
|
|
2
2
|
<ul id="login-nav" class="inline-menu">
|
|
3
|
-
<li data-hook="user-logged-in-as"><%=
|
|
4
|
-
<li data-hook="user-account-link" class='fa fa-user'><%= link_to
|
|
5
|
-
<li data-hook="user-logout-link" class='fa fa-sign-out'><%= link_to
|
|
3
|
+
<li data-hook="user-logged-in-as"><%= I18n.t('spree.logged_in_as') %>: <%= spree_current_user.email %></li>
|
|
4
|
+
<li data-hook="user-account-link" class='fa fa-user'><%= link_to I18n.t('spree.account'), spree.edit_admin_user_path(spree_current_user) %></li>
|
|
5
|
+
<li data-hook="user-logout-link" class='fa fa-sign-out'><%= link_to I18n.t('spree.logout'), spree.admin_logout_path %></li>
|
|
6
6
|
|
|
7
7
|
<% if spree.respond_to? :root_path %>
|
|
8
8
|
<li data-hook="store-frontend-link" class='fa fa-external-link'>
|
|
9
|
-
<%= link_to
|
|
9
|
+
<%= link_to I18n.t('spree.back_to_store'), spree.root_path, target: '_blank' %>
|
|
10
10
|
</li>
|
|
11
11
|
<% end %>
|
|
12
12
|
</ul>
|
|
@@ -1,21 +1,21 @@
|
|
|
1
1
|
<%= render partial: 'spree/shared/error_messages', locals: { target: @user } %>
|
|
2
|
-
<h1><%=
|
|
2
|
+
<h1><%= I18n.t('spree.registration') %></h1>
|
|
3
3
|
<div id="registration" data-hook>
|
|
4
4
|
<div id="account" class="columns alpha eight">
|
|
5
5
|
<%= render template: 'spree/user_sessions/new' %>
|
|
6
6
|
</div>
|
|
7
7
|
<% if Spree::Config[:allow_guest_checkout] %>
|
|
8
8
|
<div id="guest_checkout" data-hook class="columns omega eight">
|
|
9
|
-
<h6><%=
|
|
9
|
+
<h6><%= I18n.t('spree.guest_user_account') %></h6>
|
|
10
10
|
<% if flash[:registration_error] %>
|
|
11
11
|
<div class='flash error'><%= flash[:registration_error] %></div>
|
|
12
12
|
<% end %>
|
|
13
13
|
<%= form_for @order, url: update_checkout_registration_path, method: :put, html: { id: 'checkout_form_registration' } do |f| %>
|
|
14
14
|
<p>
|
|
15
|
-
<%= f.label :email,
|
|
15
|
+
<%= f.label :email, I18n.t('spree.email') %><br />
|
|
16
16
|
<%= f.email_field :email, class: 'title' %>
|
|
17
17
|
</p>
|
|
18
|
-
<p><%= f.submit
|
|
18
|
+
<p><%= f.submit I18n.t('spree.continue'), class: 'button primary' %></p>
|
|
19
19
|
<% end %>
|
|
20
20
|
</div>
|
|
21
21
|
<% end %>
|
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
<%= form_for Spree::User.new, as: :spree_user, url: spree.create_new_session_path do |f| %>
|
|
2
2
|
<div id="password-credentials">
|
|
3
3
|
<p>
|
|
4
|
-
<%= f.label :email,
|
|
4
|
+
<%= f.label :email, I18n.t('spree.email') %><br />
|
|
5
5
|
<%= f.email_field :email, class: 'title', tabindex: 1, autofocus: true %>
|
|
6
6
|
</p>
|
|
7
7
|
<p>
|
|
8
|
-
<%= f.label :password,
|
|
8
|
+
<%= f.label :password, I18n.t('spree.password') %><br />
|
|
9
9
|
<%= f.password_field :password, class: 'title', tabindex: 2 %>
|
|
10
10
|
</p>
|
|
11
11
|
</div>
|
|
12
12
|
<p>
|
|
13
13
|
<%= f.check_box :remember_me, tabindex: 3 %>
|
|
14
|
-
<%= f.label :remember_me,
|
|
14
|
+
<%= f.label :remember_me, I18n.t('spree.remember_me') %>
|
|
15
15
|
</p>
|
|
16
16
|
|
|
17
|
-
<p><%= f.submit
|
|
17
|
+
<p><%= f.submit I18n.t('spree.login'), class: 'button primary', tabindex: 4 %></p>
|
|
18
18
|
<% end %>
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<% if spree_current_user %>
|
|
2
|
-
<li><%= link_to
|
|
3
|
-
<li><%= link_to
|
|
2
|
+
<li><%= link_to I18n.t('spree.my_account'), spree.account_path %></li>
|
|
3
|
+
<li><%= link_to I18n.t('spree.logout'), spree.logout_path %></li>
|
|
4
4
|
<% else %>
|
|
5
|
-
<li id="link-to-login"><%= link_to
|
|
5
|
+
<li id="link-to-login"><%= link_to I18n.t('spree.login'), spree.login_path %></li>
|
|
6
6
|
<% end %>
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
<p>
|
|
2
|
-
<%= f.label :email,
|
|
2
|
+
<%= f.label :email, I18n.t('spree.email') %><br />
|
|
3
3
|
<%= f.email_field :email, class: 'title' %>
|
|
4
4
|
</p>
|
|
5
5
|
<div id="password-credentials">
|
|
6
6
|
<p>
|
|
7
|
-
<%= f.label :password,
|
|
7
|
+
<%= f.label :password, I18n.t('spree.password') %><br />
|
|
8
8
|
<%= f.password_field :password, class: 'title' %>
|
|
9
9
|
</p>
|
|
10
10
|
|
|
11
11
|
<p>
|
|
12
|
-
<%= f.label :password_confirmation,
|
|
12
|
+
<%= f.label :password_confirmation, I18n.t('spree.confirm_password') %><br />
|
|
13
13
|
<%= f.password_field :password_confirmation, class: 'title' %>
|
|
14
14
|
</p>
|
|
15
15
|
</div>
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
<%= render partial: 'spree/shared/error_messages', locals: { target: @spree_user } %>
|
|
2
2
|
<div id="change-password">
|
|
3
|
-
<h6><%=
|
|
3
|
+
<h6><%= I18n.t('spree.change_my_password') %></h6>
|
|
4
4
|
|
|
5
5
|
<%= form_for @spree_user, as: :spree_user, url: spree.update_password_path, method: :put do |f| %>
|
|
6
6
|
<p>
|
|
7
|
-
<%= f.label :password,
|
|
7
|
+
<%= f.label :password, I18n.t('spree.password') %><br />
|
|
8
8
|
<%= f.password_field :password %><br />
|
|
9
9
|
</p>
|
|
10
10
|
<p>
|
|
11
|
-
<%= f.label :password_confirmation,
|
|
11
|
+
<%= f.label :password_confirmation, I18n.t('spree.confirm_password') %><br />
|
|
12
12
|
<%= f.password_field :password_confirmation %><br />
|
|
13
13
|
</p>
|
|
14
14
|
<%= f.hidden_field :reset_password_token %>
|
|
15
|
-
<%= f.submit
|
|
15
|
+
<%= f.submit I18n.t('spree.update'), class: 'button primary' %>
|
|
16
16
|
<% end %>
|
|
17
17
|
</div>
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
<%= render partial: 'spree/shared/error_messages', locals: { target: @spree_user } %>
|
|
2
2
|
|
|
3
3
|
<div id="forgot-password">
|
|
4
|
-
<h6><%=
|
|
4
|
+
<h6><%= I18n.t('spree.forgot_password') %></h6>
|
|
5
5
|
|
|
6
|
-
<p><%=
|
|
6
|
+
<p><%= I18n.t('spree.instructions_to_reset_password') %></p>
|
|
7
7
|
|
|
8
8
|
<%= form_for Spree::User.new, as: :spree_user, url: spree.reset_password_path do |f| %>
|
|
9
9
|
<p>
|
|
10
|
-
<%= f.label :email,
|
|
10
|
+
<%= f.label :email, I18n.t('spree.email') %><br />
|
|
11
11
|
<%= f.email_field :email %>
|
|
12
12
|
</p>
|
|
13
13
|
<p>
|
|
14
|
-
<%= f.submit
|
|
14
|
+
<%= f.submit I18n.t('spree.reset_password'), class: 'button primary' %>
|
|
15
15
|
</p>
|
|
16
16
|
<% end %>
|
|
17
17
|
</div>
|
|
@@ -3,16 +3,16 @@
|
|
|
3
3
|
<%= render 'spree/shared/error_messages', target: resource %>
|
|
4
4
|
|
|
5
5
|
<div id="new-customer">
|
|
6
|
-
<h6><%=
|
|
6
|
+
<h6><%= I18n.t('spree.new_customer') %></h6>
|
|
7
7
|
|
|
8
8
|
<div data-hook="signup">
|
|
9
9
|
<%= form_for resource, as: :spree_user, url: spree.registration_path(resource) do |f| %>
|
|
10
10
|
<div data-hook="signup_inside_form">
|
|
11
11
|
<%= render partial: 'spree/shared/user_form', locals: { f: f } %>
|
|
12
|
-
<p><%= f.submit
|
|
12
|
+
<p><%= f.submit I18n.t('spree.create'), class: 'button primary' %></p>
|
|
13
13
|
</div>
|
|
14
14
|
<% end %>
|
|
15
|
-
<%=
|
|
15
|
+
<%= I18n.t('spree.or') %> <%= link_to I18n.t('spree.login_as_existing'), spree.login_path %>
|
|
16
16
|
|
|
17
17
|
</div>
|
|
18
18
|
|
|
@@ -4,10 +4,10 @@
|
|
|
4
4
|
|
|
5
5
|
<% @body_id = 'login' %>
|
|
6
6
|
<div id="existing-customer">
|
|
7
|
-
<h6><%=
|
|
7
|
+
<h6><%= I18n.t('spree.login_as_existing') %></h6>
|
|
8
8
|
<div data-hook="login">
|
|
9
9
|
<%= render partial: 'spree/shared/login' %>
|
|
10
|
-
<%=
|
|
10
|
+
<%= I18n.t('spree.or') %> <%= link_to I18n.t('spree.create_a_new_account'), spree.signup_path %> | <%= link_to I18n.t('spree.forgot_password'), spree.recover_password_path %>
|
|
11
11
|
</div>
|
|
12
12
|
</div>
|
|
13
13
|
<div data-hook="login_extras"></div>
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
<%= render partial: 'spree/shared/error_messages', locals: { target: @user } %>
|
|
2
2
|
|
|
3
3
|
<div id="edit-account">
|
|
4
|
-
<h1><%=
|
|
4
|
+
<h1><%= I18n.t('spree.editing_user') %></h1>
|
|
5
5
|
|
|
6
6
|
<div data-hook="account_edit">
|
|
7
7
|
<%= form_for Spree::User.new, as: @user, url: spree.user_path(@user), method: :put do |f| %>
|
|
8
8
|
<%= render partial: 'spree/shared/user_form', locals: { f: f } %>
|
|
9
9
|
<p>
|
|
10
|
-
<%= f.submit
|
|
10
|
+
<%= f.submit I18n.t('spree.update'), class: 'button primary' %>
|
|
11
11
|
</p>
|
|
12
12
|
<% end %>
|
|
13
13
|
</div>
|
|
@@ -2,24 +2,24 @@
|
|
|
2
2
|
|
|
3
3
|
<div data-hook="account_summary" class="account-summary">
|
|
4
4
|
<dl id="user-info">
|
|
5
|
-
<dt><%=
|
|
6
|
-
<dd><%= @user.email %> (<%= link_to
|
|
5
|
+
<dt><%= I18n.t('spree.email') %></dt>
|
|
6
|
+
<dd><%= @user.email %> (<%= link_to I18n.t('spree.edit'), spree.edit_account_path %>)</dd>
|
|
7
7
|
</dl>
|
|
8
8
|
</div>
|
|
9
9
|
|
|
10
10
|
<div data-hook="account_my_orders" class="account-my-orders">
|
|
11
11
|
|
|
12
|
-
<h3><%=
|
|
12
|
+
<h3><%= I18n.t('spree.my_orders') %></h3>
|
|
13
13
|
<% if @orders.present? %>
|
|
14
14
|
<table class="order-summary">
|
|
15
15
|
<thead>
|
|
16
16
|
<tr>
|
|
17
17
|
<th class="order-number"><%= I18n.t(:number, scope: 'activerecord.attributes.spree/order') %></th>
|
|
18
|
-
<th class="order-date"><%=
|
|
19
|
-
<th class="order-status"><%=
|
|
20
|
-
<th class="order-payment-state"><%=
|
|
21
|
-
<th class="order-shipment-state"><%=
|
|
22
|
-
<th class="order-total"><%=
|
|
18
|
+
<th class="order-date"><%= I18n.t('spree.date') %></th>
|
|
19
|
+
<th class="order-status"><%= I18n.t('spree.status') %></th>
|
|
20
|
+
<th class="order-payment-state"><%= I18n.t('spree.payment_state') %></th>
|
|
21
|
+
<th class="order-shipment-state"><%= I18n.t('spree.shipment_state') %></th>
|
|
22
|
+
<th class="order-total"><%= I18n.t('spree.total') %></th>
|
|
23
23
|
</tr>
|
|
24
24
|
</thead>
|
|
25
25
|
<tbody>
|
|
@@ -27,16 +27,16 @@
|
|
|
27
27
|
<tr class="<%= cycle('even', 'odd') %>">
|
|
28
28
|
<td class="order-number"><%= link_to order.number, order_url(order) %></td>
|
|
29
29
|
<td class="order-date"><%= l order.completed_at.to_date %></td>
|
|
30
|
-
<td class="order-status"><%=
|
|
31
|
-
<td class="order-payment-state"><%=
|
|
32
|
-
<td class="order-shipment-state"><%=
|
|
30
|
+
<td class="order-status"><%= I18n.t("spree.order_state.#{order.state}").titleize %></td>
|
|
31
|
+
<td class="order-payment-state"><%= I18n.t("spree.payment_states.#{order.payment_state}").titleize if order.payment_state %></td>
|
|
32
|
+
<td class="order-shipment-state"><%= I18n.t("spree.shipment_states.#{order.shipment_state}").titleize if order.shipment_state %></td>
|
|
33
33
|
<td class="order-total"><%= order.display_total %></td>
|
|
34
34
|
</tr>
|
|
35
35
|
<% end %>
|
|
36
36
|
</tbody>
|
|
37
37
|
</table>
|
|
38
38
|
<% else %>
|
|
39
|
-
<p><%=
|
|
39
|
+
<p><%= I18n.t('spree.you_have_no_orders_yet') %></p>
|
|
40
40
|
<% end %>
|
|
41
41
|
<br />
|
|
42
42
|
|
data/solidus_auth_devise.gemspec
CHANGED
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
# encoding: UTF-8
|
|
2
2
|
|
|
3
|
+
$:.unshift File.expand_path('lib', __dir__)
|
|
4
|
+
require 'spree/auth/version'
|
|
5
|
+
|
|
3
6
|
Gem::Specification.new do |s|
|
|
4
7
|
s.platform = Gem::Platform::RUBY
|
|
5
8
|
s.name = "solidus_auth_devise"
|
|
6
|
-
s.version =
|
|
9
|
+
s.version = Spree::Auth::VERSION
|
|
7
10
|
s.summary = "Provides authentication and authorization services for use with Solidus by using Devise and CanCan."
|
|
8
11
|
s.description = s.summary
|
|
9
12
|
|
|
@@ -29,8 +32,8 @@ Gem::Specification.new do |s|
|
|
|
29
32
|
s.add_development_dependency "capybara-screenshot"
|
|
30
33
|
s.add_development_dependency "coffee-rails"
|
|
31
34
|
s.add_development_dependency "database_cleaner", "~> 1.6"
|
|
32
|
-
s.add_development_dependency "factory_bot", "~> 4.4"
|
|
33
35
|
s.add_development_dependency "ffaker"
|
|
36
|
+
s.add_development_dependency "gem-release", "~> 2.0"
|
|
34
37
|
s.add_development_dependency "poltergeist", "~> 1.5"
|
|
35
38
|
s.add_development_dependency "rspec-rails", "~> 3.3"
|
|
36
39
|
s.add_development_dependency "sass-rails"
|
|
@@ -38,5 +41,5 @@ Gem::Specification.new do |s|
|
|
|
38
41
|
s.add_development_dependency "simplecov", "~> 0.14"
|
|
39
42
|
s.add_development_dependency "solidus_backend", solidus_version
|
|
40
43
|
s.add_development_dependency "solidus_frontend", solidus_version
|
|
41
|
-
s.add_development_dependency "sqlite3"
|
|
44
|
+
s.add_development_dependency "sqlite3", "~> 1.3.6"
|
|
42
45
|
end
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
RSpec.describe Spree::Admin::UserPasswordsController, type: :controller do
|
|
2
|
+
before { @request.env['devise.mapping'] = Devise.mappings[:spree_user] }
|
|
3
|
+
|
|
4
|
+
describe '#create' do
|
|
5
|
+
it 'responds with success' do
|
|
6
|
+
post :create, params: { spree_user: { email: 'admin@example.com' } }
|
|
7
|
+
|
|
8
|
+
expect(assigns[:spree_user].email).to eq('admin@example.com')
|
|
9
|
+
expect(response.code).to eq('200')
|
|
10
|
+
end
|
|
11
|
+
end
|
|
12
|
+
end
|
|
@@ -94,7 +94,7 @@ RSpec.describe Spree::CheckoutController, type: :controller do
|
|
|
94
94
|
request.cookie_jar.signed[:guest_token] = 'ABC'
|
|
95
95
|
post :update, params: { state: 'confirm' }
|
|
96
96
|
expect(response).to redirect_to spree.token_order_path(order, 'ABC')
|
|
97
|
-
expect(flash.notice).to eq
|
|
97
|
+
expect(flash.notice).to eq I18n.t('spree.order_processed_successfully')
|
|
98
98
|
end
|
|
99
99
|
end
|
|
100
100
|
|
|
@@ -4,11 +4,8 @@ RSpec.describe Spree::UsersController, type: :controller do
|
|
|
4
4
|
let(:user) { create(:user) }
|
|
5
5
|
let(:role) { create(:role) }
|
|
6
6
|
|
|
7
|
-
before { allow(controller).to receive(:spree_current_user) { user } }
|
|
8
|
-
|
|
9
7
|
context '#load_object' do
|
|
10
8
|
it 'redirects to signup path if user is not found' do
|
|
11
|
-
allow(controller).to receive(:spree_current_user) { nil }
|
|
12
9
|
put :update, params: { user: { email: 'foobar@example.com' } }
|
|
13
10
|
expect(response).to redirect_to spree.login_path
|
|
14
11
|
end
|
|
@@ -22,11 +19,32 @@ RSpec.describe Spree::UsersController, type: :controller do
|
|
|
22
19
|
end
|
|
23
20
|
|
|
24
21
|
context '#update' do
|
|
22
|
+
before { sign_in(user) }
|
|
23
|
+
|
|
25
24
|
context 'when updating own account' do
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
25
|
+
|
|
26
|
+
context 'when user updated successfuly' do
|
|
27
|
+
before { put :update, params: { user: { email: 'mynew@email-address.com' } } }
|
|
28
|
+
|
|
29
|
+
it 'saves user' do
|
|
30
|
+
expect(assigns[:user].email).to eq 'mynew@email-address.com'
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
it 'updates spree_current_user' do
|
|
34
|
+
expect(subject.spree_current_user.email).to eq 'mynew@email-address.com'
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
it 'redirects to account url' do
|
|
38
|
+
expect(response).to redirect_to spree.account_url(only_path: true)
|
|
39
|
+
end
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
context 'when user not valid' do
|
|
43
|
+
before { put :update, params: { user: { email: '' } } }
|
|
44
|
+
|
|
45
|
+
it 'does not affect spree_current_user' do
|
|
46
|
+
expect(subject.spree_current_user.email).to eq user.email
|
|
47
|
+
end
|
|
30
48
|
end
|
|
31
49
|
end
|
|
32
50
|
|
|
@@ -2,23 +2,18 @@ require 'spec_helper'
|
|
|
2
2
|
|
|
3
3
|
feature 'Confirmation' do
|
|
4
4
|
before do
|
|
5
|
-
|
|
5
|
+
set_confirmable_option(false)
|
|
6
|
+
allow(Spree::UserMailer).to receive(:confirmation_instructions)
|
|
7
|
+
.and_return(double(deliver: true))
|
|
6
8
|
end
|
|
7
9
|
|
|
8
|
-
before do
|
|
9
|
-
set_confirmable_option(true)
|
|
10
|
-
Spree::UserMailer.stub(:confirmation_instructions).and_return(double(deliver: true))
|
|
11
|
-
end
|
|
12
|
-
|
|
13
|
-
#after(:each) { set_confirmable_option(false) }
|
|
14
|
-
|
|
15
10
|
let!(:store) { create(:store) }
|
|
16
11
|
|
|
17
12
|
background do
|
|
18
13
|
ActionMailer::Base.default_url_options[:host] = 'http://example.com'
|
|
19
14
|
end
|
|
20
15
|
|
|
21
|
-
scenario 'create a new user' do
|
|
16
|
+
scenario 'create a new user', :js do
|
|
22
17
|
visit spree.signup_path
|
|
23
18
|
|
|
24
19
|
fill_in 'Email', with: 'email@person.com'
|
data/spec/models/user_spec.rb
CHANGED
|
@@ -78,11 +78,9 @@ RSpec.describe Spree::User, type: :model do
|
|
|
78
78
|
end
|
|
79
79
|
|
|
80
80
|
describe "confirmable" do
|
|
81
|
-
before { skip "this introduces a run order dependency" }
|
|
82
|
-
|
|
83
81
|
it "is confirmable if the confirmable option is enabled" do
|
|
84
82
|
set_confirmable_option(true)
|
|
85
|
-
Spree::UserMailer.
|
|
83
|
+
allow(Spree::UserMailer).to receive(:confirmation_instructions).and_return(double(deliver: true))
|
|
86
84
|
expect(Spree::User.devise_modules).to include(:confirmable)
|
|
87
85
|
set_confirmable_option(false)
|
|
88
86
|
end
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
module ConfirmHelpers
|
|
2
2
|
def set_confirmable_option(value)
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
3
|
+
if value
|
|
4
|
+
Spree::User.devise_modules.push(:confirmable)
|
|
5
|
+
Spree::Auth::Config.set(confirmable: true)
|
|
6
|
+
else
|
|
7
|
+
Spree::User.devise_modules.delete(:confirmable)
|
|
8
|
+
Spree::Auth::Config.set(confirmable: false)
|
|
9
|
+
end
|
|
8
10
|
end
|
|
9
11
|
end
|
|
10
12
|
|
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: 2.
|
|
4
|
+
version: 2.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:
|
|
11
|
+
date: 2019-06-13 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: solidus_core
|
|
@@ -129,33 +129,33 @@ dependencies:
|
|
|
129
129
|
- !ruby/object:Gem::Version
|
|
130
130
|
version: '1.6'
|
|
131
131
|
- !ruby/object:Gem::Dependency
|
|
132
|
-
name:
|
|
132
|
+
name: ffaker
|
|
133
133
|
requirement: !ruby/object:Gem::Requirement
|
|
134
134
|
requirements:
|
|
135
|
-
- - "
|
|
135
|
+
- - ">="
|
|
136
136
|
- !ruby/object:Gem::Version
|
|
137
|
-
version: '
|
|
137
|
+
version: '0'
|
|
138
138
|
type: :development
|
|
139
139
|
prerelease: false
|
|
140
140
|
version_requirements: !ruby/object:Gem::Requirement
|
|
141
141
|
requirements:
|
|
142
|
-
- - "
|
|
142
|
+
- - ">="
|
|
143
143
|
- !ruby/object:Gem::Version
|
|
144
|
-
version: '
|
|
144
|
+
version: '0'
|
|
145
145
|
- !ruby/object:Gem::Dependency
|
|
146
|
-
name:
|
|
146
|
+
name: gem-release
|
|
147
147
|
requirement: !ruby/object:Gem::Requirement
|
|
148
148
|
requirements:
|
|
149
|
-
- - "
|
|
149
|
+
- - "~>"
|
|
150
150
|
- !ruby/object:Gem::Version
|
|
151
|
-
version: '0'
|
|
151
|
+
version: '2.0'
|
|
152
152
|
type: :development
|
|
153
153
|
prerelease: false
|
|
154
154
|
version_requirements: !ruby/object:Gem::Requirement
|
|
155
155
|
requirements:
|
|
156
|
-
- - "
|
|
156
|
+
- - "~>"
|
|
157
157
|
- !ruby/object:Gem::Version
|
|
158
|
-
version: '0'
|
|
158
|
+
version: '2.0'
|
|
159
159
|
- !ruby/object:Gem::Dependency
|
|
160
160
|
name: poltergeist
|
|
161
161
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -270,16 +270,16 @@ dependencies:
|
|
|
270
270
|
name: sqlite3
|
|
271
271
|
requirement: !ruby/object:Gem::Requirement
|
|
272
272
|
requirements:
|
|
273
|
-
- - "
|
|
273
|
+
- - "~>"
|
|
274
274
|
- !ruby/object:Gem::Version
|
|
275
|
-
version:
|
|
275
|
+
version: 1.3.6
|
|
276
276
|
type: :development
|
|
277
277
|
prerelease: false
|
|
278
278
|
version_requirements: !ruby/object:Gem::Requirement
|
|
279
279
|
requirements:
|
|
280
|
-
- - "
|
|
280
|
+
- - "~>"
|
|
281
281
|
- !ruby/object:Gem::Version
|
|
282
|
-
version:
|
|
282
|
+
version: 1.3.6
|
|
283
283
|
description: Provides authentication and authorization services for use with Solidus
|
|
284
284
|
by using Devise and CanCan.
|
|
285
285
|
email: contact@solidus.io
|
|
@@ -287,6 +287,8 @@ executables: []
|
|
|
287
287
|
extensions: []
|
|
288
288
|
extra_rdoc_files: []
|
|
289
289
|
files:
|
|
290
|
+
- ".circleci/config.yml"
|
|
291
|
+
- ".gem_release.yml"
|
|
290
292
|
- ".gitignore"
|
|
291
293
|
- ".rspec"
|
|
292
294
|
- ".travis.yml"
|
|
@@ -301,7 +303,6 @@ files:
|
|
|
301
303
|
- app/overrides/auth_admin_login_navigation_bar.rb
|
|
302
304
|
- app/overrides/auth_shared_login_bar.rb
|
|
303
305
|
- bin/rails
|
|
304
|
-
- circle.yml
|
|
305
306
|
- config/initializers/devise.rb
|
|
306
307
|
- config/initializers/warden.rb
|
|
307
308
|
- config/locales/de.yml
|
|
@@ -322,13 +323,13 @@ files:
|
|
|
322
323
|
- db/migrate/20120605211305_make_users_email_index_unique.rb
|
|
323
324
|
- db/migrate/20140904000425_add_deleted_at_to_users.rb
|
|
324
325
|
- db/migrate/20141002154641_add_confirmable_to_users.rb
|
|
326
|
+
- db/migrate/20190125170630_add_reset_password_token_index_to_spree_users.rb
|
|
325
327
|
- db/seeds.rb
|
|
326
328
|
- lib/assets/javascripts/spree/backend/solidus_auth.js
|
|
327
329
|
- lib/assets/javascripts/spree/frontend/solidus_auth.js
|
|
328
330
|
- lib/assets/stylesheets/spree/backend/solidus_auth.css
|
|
329
331
|
- lib/assets/stylesheets/spree/frontend/solidus_auth.css
|
|
330
332
|
- lib/controllers/backend/spree/admin/admin_controller_decorator.rb
|
|
331
|
-
- lib/controllers/backend/spree/admin/admin_orders_controller_decorator.rb
|
|
332
333
|
- lib/controllers/backend/spree/admin/orders/customer_details_controller_decorator.rb
|
|
333
334
|
- lib/controllers/backend/spree/admin/user_passwords_controller.rb
|
|
334
335
|
- lib/controllers/backend/spree/admin/user_sessions_controller.rb
|
|
@@ -344,6 +345,7 @@ files:
|
|
|
344
345
|
- lib/solidus_auth_devise.rb
|
|
345
346
|
- lib/spree/auth/devise.rb
|
|
346
347
|
- lib/spree/auth/engine.rb
|
|
348
|
+
- lib/spree/auth/version.rb
|
|
347
349
|
- lib/spree/authentication_helpers.rb
|
|
348
350
|
- lib/tasks/auth.rake
|
|
349
351
|
- lib/views/backend/spree/admin/shared/_navigation_footer.html.erb
|
|
@@ -368,6 +370,7 @@ files:
|
|
|
368
370
|
- lib/views/frontend/spree/users/edit.html.erb
|
|
369
371
|
- lib/views/frontend/spree/users/show.html.erb
|
|
370
372
|
- solidus_auth_devise.gemspec
|
|
373
|
+
- spec/controllers/spree/admin/user_passwords_controller_spec.rb
|
|
371
374
|
- spec/controllers/spree/checkout_controller_spec.rb
|
|
372
375
|
- spec/controllers/spree/products_controller_spec.rb
|
|
373
376
|
- spec/controllers/spree/user_passwords_controller_spec.rb
|
|
@@ -427,6 +430,7 @@ specification_version: 4
|
|
|
427
430
|
summary: Provides authentication and authorization services for use with Solidus by
|
|
428
431
|
using Devise and CanCan.
|
|
429
432
|
test_files:
|
|
433
|
+
- spec/controllers/spree/admin/user_passwords_controller_spec.rb
|
|
430
434
|
- spec/controllers/spree/checkout_controller_spec.rb
|
|
431
435
|
- spec/controllers/spree/products_controller_spec.rb
|
|
432
436
|
- spec/controllers/spree/user_passwords_controller_spec.rb
|
data/circle.yml
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
Spree::Admin::OrdersController.class_eval do
|
|
2
|
-
before_action :check_authorization
|
|
3
|
-
|
|
4
|
-
private
|
|
5
|
-
def load_order_action
|
|
6
|
-
[:edit, :update, :cancel, :resume, :approve, :resend, :open_adjustments, :close_adjustments, :cart]
|
|
7
|
-
end
|
|
8
|
-
|
|
9
|
-
def check_authorization
|
|
10
|
-
action = params[:action].to_sym
|
|
11
|
-
if load_order_action.include?(action)
|
|
12
|
-
load_order
|
|
13
|
-
session[:access_token] ||= params[:token]
|
|
14
|
-
resource = @order || Spree::Order.new
|
|
15
|
-
authorize! action, resource, session[:access_token]
|
|
16
|
-
else
|
|
17
|
-
authorize! :index, Spree::Order
|
|
18
|
-
end
|
|
19
|
-
end
|
|
20
|
-
end
|