solidus_social 1.4.0 → 1.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.circleci/config.yml +3 -0
- data/.github/dependabot.yml +7 -0
- data/Gemfile +7 -1
- data/README.md +44 -43
- data/app/controllers/spree/omniauth_callbacks_controller.rb +1 -1
- data/app/views/spree/shared/_social.html.erb +7 -3
- data/lib/generators/solidus_social/install/templates/config/initializers/solidus_social.rb +1 -10
- data/lib/solidus_social/engine.rb +2 -7
- data/{app/models/spree → lib/solidus_social}/social_configuration.rb +2 -0
- data/lib/solidus_social/version.rb +1 -1
- data/solidus_social.gemspec +1 -2
- data/spec/controllers/spree/omniauth_callbacks_controller_spec.rb +17 -17
- data/spec/features/spree/admin/authentication_methods_configuration_spec.rb +2 -2
- data/spec/features/spree/sign_in_spec.rb +80 -10
- data/spec/lib/spree/social_config_spec.rb +1 -1
- data/spec/models/spree/authentication_method_spec.rb +0 -2
- metadata +6 -19
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1877be6601ecd77f99eb28f6bb0ddf0b6b702cb80a7ca163f5472f5a34a3937f
|
4
|
+
data.tar.gz: 9ac2438fad599892a90abde85e1d20bed50641e0a5661c906e8950436fa52041
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c3c7b24eee76fbe4a361c6da83ad7e3f4d88e78b4686db243b6ec995a48454929ef9bb00e92d987994a0b7bbb6cae1e10598f75cb10a82ec30225c5c16208c22
|
7
|
+
data.tar.gz: e96864533c0a6d567afef96682601126ce50591f99d179205e9e8420ab6942b0e58ffb9e2b39eccdbc7de119cbbc182cb3366d290e025e42c051c15298b70e85
|
data/.circleci/config.yml
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
version: 2.1
|
2
2
|
|
3
3
|
orbs:
|
4
|
+
browser-tools: circleci/browser-tools@1.4
|
4
5
|
# Always take the latest version of the orb, this allows us to
|
5
6
|
# run specs against Solidus supported versions only without the need
|
6
7
|
# to change this configuration every time a Solidus version is released
|
@@ -11,10 +12,12 @@ jobs:
|
|
11
12
|
run-specs-with-postgres:
|
12
13
|
executor: solidusio_extensions/postgres
|
13
14
|
steps:
|
15
|
+
- browser-tools/install-browser-tools
|
14
16
|
- solidusio_extensions/run-tests
|
15
17
|
run-specs-with-mysql:
|
16
18
|
executor: solidusio_extensions/mysql
|
17
19
|
steps:
|
20
|
+
- browser-tools/install-browser-tools
|
18
21
|
- solidusio_extensions/run-tests
|
19
22
|
|
20
23
|
workflows:
|
data/Gemfile
CHANGED
@@ -4,7 +4,13 @@ source 'https://rubygems.org'
|
|
4
4
|
git_source(:github) { |repo| "https://github.com/#{repo}.git" }
|
5
5
|
|
6
6
|
branch = ENV.fetch('SOLIDUS_BRANCH', 'master')
|
7
|
-
|
7
|
+
solidus_git, solidus_frontend_git = if (branch == 'master') || (branch >= 'v3.2')
|
8
|
+
%w[solidusio/solidus solidusio/solidus_frontend]
|
9
|
+
else
|
10
|
+
%w[solidusio/solidus] * 2
|
11
|
+
end
|
12
|
+
gem 'solidus', github: solidus_git, branch: branch
|
13
|
+
gem 'solidus_frontend', github: solidus_frontend_git, branch: branch
|
8
14
|
|
9
15
|
# Needed to help Bundler figure out how to resolve dependencies,
|
10
16
|
# otherwise it takes forever to resolve them.
|
data/README.md
CHANGED
@@ -5,8 +5,8 @@ SolidusSocial
|
|
5
5
|
[![Code Climate](https://codeclimate.com/github/solidusio-contrib/solidus_social/badges/gpa.svg)](https://codeclimate.com/github/solidusio-contrib/solidus_social)
|
6
6
|
|
7
7
|
Social login support for Solidus. Solidus Social handles authorization, account
|
8
|
-
creation and association through third-party services.
|
9
|
-
Facebook, Github
|
8
|
+
creation and association through third-party services.
|
9
|
+
Currently Facebook, Github and Google OAuth2 are available out of the box.
|
10
10
|
|
11
11
|
Installation
|
12
12
|
------------
|
@@ -44,7 +44,7 @@ Click "New Authentication Method" and choose one of your configured providers.
|
|
44
44
|
Registering Your Application
|
45
45
|
----------------------------
|
46
46
|
|
47
|
-
Facebook,
|
47
|
+
Facebook, Github and Google OAuth2 are supported out of the
|
48
48
|
box but, you will need to register your application with each of the sites you
|
49
49
|
want to use.
|
50
50
|
|
@@ -64,20 +64,6 @@ Make sure you specifity the right IP address.
|
|
64
64
|
`http://your-site.com` for production
|
65
65
|
- Site domain: `yourhostname.local` and `your-site.com` respectively
|
66
66
|
|
67
|
-
### Twitter
|
68
|
-
|
69
|
-
[Twitter / Application Management / Create an application][3]
|
70
|
-
|
71
|
-
1. Fill in the name and description.
|
72
|
-
2. Fill in the rest of the details:
|
73
|
-
- Application Website: `http://yourhostname.local:3000` for development and
|
74
|
-
`http://your-site.com` for production
|
75
|
-
- Application Type: "Browser"
|
76
|
-
- Callback URL: `http://yourhostname.local:3000` for development and
|
77
|
-
`http://your-site.com` for production
|
78
|
-
- Default Access Type: "Read & Write"
|
79
|
-
6. Save the application.
|
80
|
-
|
81
67
|
### Github
|
82
68
|
|
83
69
|
[Github / Applications / Register a new OAuth application][4]
|
@@ -90,18 +76,6 @@ Make sure you specifity the right IP address.
|
|
90
76
|
`http://your-site.com` for production
|
91
77
|
4. Click Create.
|
92
78
|
|
93
|
-
### Amazon
|
94
|
-
|
95
|
-
[Amazon / App Console / Register a new OAuth application][10]
|
96
|
-
|
97
|
-
1. Register New Application.
|
98
|
-
2. Name the Application, provide description and URL for Privacy Policy.
|
99
|
-
3. Click Save.
|
100
|
-
4. Add Your site under Web Settings > Allowed Return URLs (example:
|
101
|
-
`http://localhost:3000/users/auth/amazon/callback`)
|
102
|
-
|
103
|
-
> The app console is available at [https://login.amazon.com/manageApps](https://login.amazon.com/manageApps)
|
104
|
-
|
105
79
|
### Google OAuth2
|
106
80
|
[Google / APIs / Credentials/ Create Credential](https://console.developers.google.com/)
|
107
81
|
|
@@ -140,11 +114,40 @@ strategy][12] for them. (If there isn't, you can [write one][13].)
|
|
140
114
|
your LinkedIn link.
|
141
115
|
- Include in your CSS a definition for `.icon-spree-linkedin-circled` and an
|
142
116
|
embedded icon font for LinkedIn from [Fontello][14] (the way existing
|
143
|
-
icons for Facebook
|
117
|
+
icons for Facebook etc are implemented). You can also override
|
144
118
|
CSS classes for other providers, `.icon-spree-<provider>-circled`, to use
|
145
119
|
different font icons or classic background images, without having to
|
146
120
|
override views.
|
147
121
|
|
122
|
+
#### Apple Id Example
|
123
|
+
|
124
|
+
1. Add `gem "omniauth-apple"` to your Gemfile and run `bundle install`.
|
125
|
+
2. In `config/initializers/solidus_social.rb` add and initialize a new provider
|
126
|
+
for SolidusSocial:
|
127
|
+
|
128
|
+
```ruby
|
129
|
+
|
130
|
+
config.providers = {
|
131
|
+
apple: {
|
132
|
+
icon: 'fa-apple',
|
133
|
+
title: 'Apple'
|
134
|
+
},
|
135
|
+
# More providers here
|
136
|
+
```
|
137
|
+
add its configuration after `SolidusSocial.init_providers` line:
|
138
|
+
```ruby
|
139
|
+
|
140
|
+
Devise.setup do |config|
|
141
|
+
# The configuration key has to match your omniauth strategy.
|
142
|
+
config.omniauth :apple, ENV['APPLE_CLIENT_ID'], '',
|
143
|
+
scope: 'email',
|
144
|
+
team_id: ENV['APPLE_TEAM_ID'],
|
145
|
+
key_id: ENV['APPLE_KEY_ID'],
|
146
|
+
pem: ENV['APPLE_PRIVATE_KEY'].gsub('\n', "\n")
|
147
|
+
end
|
148
|
+
```
|
149
|
+
Notice: APPLE_PRIVATE_KEY should consist from one-line p8-file content, like this `'\n-----BEGIN PRIVATE KEY-----\nsecret\n-----END PRIVATE KEY-----\n'`
|
150
|
+
|
148
151
|
Documentation
|
149
152
|
-------------
|
150
153
|
|
@@ -188,16 +191,14 @@ Copyright (c) 2014 [John Dyer][7] and [contributors][8], released under the [New
|
|
188
191
|
|
189
192
|
[1]: https://github.com/spree/spree
|
190
193
|
[2]: https://developers.facebook.com/apps/?action=create
|
191
|
-
[3]: https://
|
192
|
-
[4]:
|
193
|
-
[5]:
|
194
|
-
[6]: https://github.com/
|
195
|
-
[7]: https://github.com/
|
196
|
-
[8]: https://github.com/solidusio-contrib/solidus_social/
|
197
|
-
[9]: https://github.com/solidusio-contrib/solidus_social/blob/master/
|
198
|
-
[10]: https://
|
199
|
-
[11]: https://github.com/
|
200
|
-
[12]:
|
201
|
-
[13]:
|
202
|
-
[14]: http://fontello.com/
|
203
|
-
[15]: http://www.rubydoc.info/github/solidusio-contrib/solidus_social/
|
194
|
+
[3]: https://github.com/settings/applications/new
|
195
|
+
[4]: http://www.fsf.org/licensing/essays/free-sw.html
|
196
|
+
[5]: https://github.com/solidusio-contrib/solidus_social/issues
|
197
|
+
[6]: https://github.com/LBRapid
|
198
|
+
[7]: https://github.com/solidusio-contrib/solidus_social/graphs/contributors
|
199
|
+
[8]: https://github.com/solidusio-contrib/solidus_social/blob/master/LICENSE
|
200
|
+
[9]: https://github.com/solidusio-contrib/solidus_social/blob/master/CONTRIBUTING.md
|
201
|
+
[10]: https://github.com/intridea/omniauth/wiki/List-of-Strategies
|
202
|
+
[11]: https://github.com/intridea/omniauth/wiki/Strategy-Contribution-Guide
|
203
|
+
[12]: http://fontello.com/
|
204
|
+
[13]: http://www.rubydoc.info/github/solidusio-contrib/solidus_social/
|
@@ -62,7 +62,7 @@ class Spree::OmniauthCallbacksController < Devise::OmniauthCallbacksController
|
|
62
62
|
end
|
63
63
|
|
64
64
|
def passthru
|
65
|
-
render file: "#{Rails.root}/public/404", formats: [:html], status: :not_found, layout: false
|
65
|
+
render file: "#{Rails.root}/public/404.html", formats: [:html], status: :not_found, layout: false
|
66
66
|
end
|
67
67
|
|
68
68
|
def auth_hash
|
@@ -4,8 +4,12 @@
|
|
4
4
|
<% end %>
|
5
5
|
|
6
6
|
<% Spree::AuthenticationMethod.available_for(spree_current_user).each do |method| %>
|
7
|
-
|
8
|
-
|
9
|
-
|
7
|
+
<% if method.active %>
|
8
|
+
<%= form_tag(spree.send("spree_user_#{method.provider}_omniauth_authorize_path", r: rand), method: 'post') do %>
|
9
|
+
<%= button_tag(type: 'submit', title: t('spree.sign_in_with', provider: method.provider)) do %>
|
10
|
+
<%= content_tag(:i, '', class: "icon-spree-#{method.provider.dasherize}-circled") %>
|
11
|
+
<% end %>
|
12
|
+
<% end %>
|
13
|
+
<% end %>
|
10
14
|
<% end %>
|
11
15
|
</div>
|
@@ -18,10 +18,6 @@ Spree::SocialConfig.configure do |config|
|
|
18
18
|
api_key: ENV['FACEBOOK_API_KEY'],
|
19
19
|
api_secret: ENV['FACEBOOK_API_SECRET'],
|
20
20
|
},
|
21
|
-
twitter: {
|
22
|
-
api_key: ENV['TWITTER_API_KEY'],
|
23
|
-
api_secret: ENV['TWITTER_API_SECRET'],
|
24
|
-
},
|
25
21
|
github: {
|
26
22
|
api_key: ENV['GITHUB_API_KEY'],
|
27
23
|
api_secret: ENV['GITHUB_API_SECRET'],
|
@@ -29,10 +25,6 @@ Spree::SocialConfig.configure do |config|
|
|
29
25
|
google_oauth2: {
|
30
26
|
api_key: ENV['GOOGLE_OAUTH2_API_KEY'],
|
31
27
|
api_secret: ENV['GOOGLE_OAUTH2_API_SECRET'],
|
32
|
-
},
|
33
|
-
amazon: {
|
34
|
-
api_key: ENV['AMAZON_API_KEY'],
|
35
|
-
api_secret: ENV['AMAZON_API_SECRET'],
|
36
28
|
}
|
37
29
|
}
|
38
30
|
end
|
@@ -44,7 +36,6 @@ OmniAuth.logger.progname = 'omniauth'
|
|
44
36
|
|
45
37
|
OmniAuth.config.on_failure = proc do |env|
|
46
38
|
env['devise.mapping'] = Devise.mappings[Spree.user_class.table_name.singularize.to_sym]
|
47
|
-
|
48
|
-
controller_klass = ActiveSupport::Inflector.constantize("#{controller_name}Controller")
|
39
|
+
controller_klass = ActiveSupport::Inflector.constantize("Spree::OmniauthCallbacksController")
|
49
40
|
controller_klass.action(:failure).call(env)
|
50
41
|
end
|
@@ -1,13 +1,12 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require 'omniauth-twitter'
|
4
3
|
require 'omniauth-facebook'
|
5
4
|
require 'omniauth-github'
|
6
5
|
require 'omniauth-google-oauth2'
|
7
|
-
require 'omniauth
|
6
|
+
require 'omniauth/rails_csrf_protection'
|
8
7
|
require 'deface'
|
9
|
-
require 'coffee_script'
|
10
8
|
require 'spree/core'
|
9
|
+
require 'solidus_social/social_configuration'
|
11
10
|
require 'solidus_social/facebook_omniauth_strategy_ext'
|
12
11
|
|
13
12
|
module SolidusSocial
|
@@ -27,10 +26,6 @@ module SolidusSocial
|
|
27
26
|
"app/decorators/models/solidus_social/spree/user_decorator.rb"
|
28
27
|
).to_s
|
29
28
|
|
30
|
-
initializer 'solidus_social.environment', before: 'spree.environment' do
|
31
|
-
::Spree::SocialConfig = ::Spree::SocialConfiguration.new
|
32
|
-
end
|
33
|
-
|
34
29
|
initializer 'solidus_social.decorate_spree_user' do |app|
|
35
30
|
next unless app.respond_to?(:reloader)
|
36
31
|
|
data/solidus_social.gemspec
CHANGED
@@ -31,11 +31,10 @@ Gem::Specification.new do |spec|
|
|
31
31
|
spec.add_dependency 'deface'
|
32
32
|
spec.add_dependency 'oa-core'
|
33
33
|
spec.add_dependency 'omniauth'
|
34
|
-
spec.add_dependency 'omniauth-amazon'
|
35
34
|
spec.add_dependency 'omniauth-facebook'
|
36
35
|
spec.add_dependency 'omniauth-github'
|
37
36
|
spec.add_dependency 'omniauth-google-oauth2'
|
38
|
-
spec.add_dependency 'omniauth-
|
37
|
+
spec.add_dependency 'omniauth-rails_csrf_protection'
|
39
38
|
spec.add_dependency 'solidus_auth_devise'
|
40
39
|
spec.add_dependency 'solidus_core', ['>= 2.0.0', '< 4']
|
41
40
|
spec.add_dependency 'solidus_support', '~> 0.5'
|
@@ -18,17 +18,17 @@ RSpec.describe Spree::OmniauthCallbacksController, type: :controller do
|
|
18
18
|
|
19
19
|
it 'redirects properly' do
|
20
20
|
expect(controller).to receive(:redirect_back_or_default)
|
21
|
-
controller.
|
21
|
+
controller.github
|
22
22
|
end
|
23
23
|
|
24
24
|
it 'displays an error message' do
|
25
|
-
controller.
|
25
|
+
controller.github
|
26
26
|
expect(flash[:error]).not_to be_blank
|
27
27
|
end
|
28
28
|
|
29
29
|
it 'does not attempt authentication' do
|
30
30
|
expect(controller).not_to receive(:sign_in_and_redirect)
|
31
|
-
controller.
|
31
|
+
controller.github
|
32
32
|
end
|
33
33
|
end
|
34
34
|
|
@@ -37,7 +37,7 @@ RSpec.describe Spree::OmniauthCallbacksController, type: :controller do
|
|
37
37
|
|
38
38
|
it 'associates the order with the user' do
|
39
39
|
expect(order).to receive(:associate_user!).with(user)
|
40
|
-
controller.
|
40
|
+
controller.github
|
41
41
|
end
|
42
42
|
end
|
43
43
|
|
@@ -64,17 +64,17 @@ RSpec.describe Spree::OmniauthCallbacksController, type: :controller do
|
|
64
64
|
|
65
65
|
it 'does not need to create the user_authentication' do
|
66
66
|
expect(user.user_authentications).not_to receive(:create!)
|
67
|
-
controller.
|
67
|
+
controller.github
|
68
68
|
end
|
69
69
|
|
70
70
|
it 'sets the flash notice' do
|
71
|
-
controller.
|
71
|
+
controller.github
|
72
72
|
expect(flash[:notice]).not_to be_blank
|
73
73
|
end
|
74
74
|
|
75
75
|
it 'authenticates as that user' do
|
76
76
|
expect(controller).to receive(:sign_in_and_redirect)
|
77
|
-
controller.
|
77
|
+
controller.github
|
78
78
|
end
|
79
79
|
end
|
80
80
|
|
@@ -86,17 +86,17 @@ RSpec.describe Spree::OmniauthCallbacksController, type: :controller do
|
|
86
86
|
it 'creates a new user_authentication' do
|
87
87
|
expect(user).to receive(:apply_omniauth)
|
88
88
|
expect(user).to receive(:save!)
|
89
|
-
controller.
|
89
|
+
controller.github
|
90
90
|
end
|
91
91
|
|
92
92
|
it 'sets the flash notice' do
|
93
|
-
controller.
|
93
|
+
controller.github
|
94
94
|
expect(flash[:notice]).not_to be_blank
|
95
95
|
end
|
96
96
|
|
97
97
|
it 'redirects properly' do
|
98
98
|
expect(controller).to receive(:redirect_back_or_default)
|
99
|
-
controller.
|
99
|
+
controller.github
|
100
100
|
end
|
101
101
|
|
102
102
|
it_behaves_like 'associate_order'
|
@@ -119,17 +119,17 @@ RSpec.describe Spree::OmniauthCallbacksController, type: :controller do
|
|
119
119
|
|
120
120
|
it 'does not need to create the user_authentication' do
|
121
121
|
expect(user.user_authentications).not_to receive(:create!)
|
122
|
-
controller.
|
122
|
+
controller.github
|
123
123
|
end
|
124
124
|
|
125
125
|
it 'does not create a new user account' do
|
126
126
|
expect(Spree::User).not_to receive :new
|
127
|
-
controller.
|
127
|
+
controller.github
|
128
128
|
end
|
129
129
|
|
130
130
|
it 'authenticates as that user' do
|
131
131
|
expect(controller).to receive(:sign_in_and_redirect).with(:spree_user, user)
|
132
|
-
controller.
|
132
|
+
controller.github
|
133
133
|
end
|
134
134
|
end
|
135
135
|
|
@@ -144,7 +144,7 @@ RSpec.describe Spree::OmniauthCallbacksController, type: :controller do
|
|
144
144
|
context "email doesn't belongs to anyone" do
|
145
145
|
it 'creates a new user' do
|
146
146
|
expect(controller).to receive(:sign_in_and_redirect)
|
147
|
-
expect { controller.
|
147
|
+
expect { controller.github }.to change(Spree::User, :count).by(1)
|
148
148
|
end
|
149
149
|
|
150
150
|
context 'when `Spree.user_class` has changed' do
|
@@ -170,7 +170,7 @@ RSpec.describe Spree::OmniauthCallbacksController, type: :controller do
|
|
170
170
|
expect(Spree::User).not_to receive :new
|
171
171
|
expect_any_instance_of(Spree::User).not_to receive :save
|
172
172
|
|
173
|
-
expect { controller.
|
173
|
+
expect { controller.github }
|
174
174
|
.to change(Spree::LegacyUser, :count).by(1)
|
175
175
|
end
|
176
176
|
end
|
@@ -180,11 +180,11 @@ RSpec.describe Spree::OmniauthCallbacksController, type: :controller do
|
|
180
180
|
before { @user = create(:user, email: 'spree@gmail.com') }
|
181
181
|
|
182
182
|
it 'does not create new user' do
|
183
|
-
expect { controller.
|
183
|
+
expect { controller.github }.not_to change(Spree::User, :count)
|
184
184
|
end
|
185
185
|
|
186
186
|
it 'assigns authentication to existing user' do
|
187
|
-
expect { controller.
|
187
|
+
expect { controller.github }.to change(@user.user_authentications, :count).by(1)
|
188
188
|
end
|
189
189
|
end
|
190
190
|
end
|
@@ -19,10 +19,10 @@ RSpec.describe 'Admin Authentication Methods', :js do
|
|
19
19
|
end
|
20
20
|
|
21
21
|
it 'can create new' do
|
22
|
-
expect(page).to have_text
|
22
|
+
expect(page).to have_text 'No Authentication Methods Found, Add One!'
|
23
23
|
|
24
24
|
click_link 'New Authentication Method'
|
25
|
-
expect(page).to
|
25
|
+
expect(page).to have_link 'Back To Authentication Methods List'
|
26
26
|
select2 'Test', from: 'Environment'
|
27
27
|
select2 'Github', from: 'Social Provider'
|
28
28
|
|
@@ -53,21 +53,73 @@ RSpec.describe 'Signing in using Omniauth', :js do
|
|
53
53
|
end
|
54
54
|
end
|
55
55
|
|
56
|
-
context '
|
56
|
+
context 'github' do
|
57
57
|
before do
|
58
58
|
Spree::AuthenticationMethod.create!(
|
59
|
-
provider: '
|
59
|
+
provider: 'github',
|
60
60
|
api_key: 'fake',
|
61
61
|
api_secret: 'fake',
|
62
62
|
environment: Rails.env,
|
63
63
|
active: true
|
64
64
|
)
|
65
|
-
OmniAuth.config.
|
66
|
-
|
67
|
-
'provider' => 'twitter',
|
65
|
+
OmniAuth.config.mock_auth[:github] = {
|
66
|
+
'provider' => 'github',
|
68
67
|
'uid' => '123545',
|
69
68
|
'info' => {
|
70
69
|
'name' => 'mockuser',
|
70
|
+
'email' => 'mockuser@example.com',
|
71
|
+
'image' => 'mock_user_thumbnail_url'
|
72
|
+
},
|
73
|
+
'credentials' => {
|
74
|
+
'token' => 'mock_token',
|
75
|
+
'secret' => 'mock_secret'
|
76
|
+
}
|
77
|
+
}
|
78
|
+
end
|
79
|
+
|
80
|
+
it 'going to sign in' do
|
81
|
+
visit spree.login_path
|
82
|
+
click_on 'Login with github'
|
83
|
+
expect(page).to have_text 'You are now signed in with your github account.'
|
84
|
+
click_link 'Logout'
|
85
|
+
click_link 'Login'
|
86
|
+
click_on 'Login with github'
|
87
|
+
expect(page).to have_text 'You are now signed in with your github account.'
|
88
|
+
end
|
89
|
+
|
90
|
+
# Regression test for #91
|
91
|
+
it "attempting to view 'My Account' works" do
|
92
|
+
visit spree.login_path
|
93
|
+
click_on 'Login with github'
|
94
|
+
expect(page).to have_text 'You are now signed in with your github account.'
|
95
|
+
click_link 'My Account'
|
96
|
+
expect(page).to have_text 'My Account'
|
97
|
+
end
|
98
|
+
|
99
|
+
it "view 'My Account'" do
|
100
|
+
visit spree.login_path
|
101
|
+
click_on 'Login with github'
|
102
|
+
expect(page).to have_text 'You are now signed in with your github account.'
|
103
|
+
click_link 'My Account'
|
104
|
+
expect(page).not_to have_selector 'div#social-signin-links'
|
105
|
+
end
|
106
|
+
end
|
107
|
+
|
108
|
+
context 'google_oauth2' do
|
109
|
+
before do
|
110
|
+
Spree::AuthenticationMethod.create!(
|
111
|
+
provider: 'google_oauth2',
|
112
|
+
api_key: 'fake',
|
113
|
+
api_secret: 'fake',
|
114
|
+
environment: Rails.env,
|
115
|
+
active: true
|
116
|
+
)
|
117
|
+
OmniAuth.config.mock_auth[:google_oauth2] = {
|
118
|
+
'provider' => 'google_oauth2',
|
119
|
+
'uid' => '123545',
|
120
|
+
'info' => {
|
121
|
+
'name' => 'mockuser',
|
122
|
+
'email' => 'mockuser@example.com',
|
71
123
|
'image' => 'mock_user_thumbnail_url'
|
72
124
|
},
|
73
125
|
'credentials' => {
|
@@ -79,11 +131,29 @@ RSpec.describe 'Signing in using Omniauth', :js do
|
|
79
131
|
|
80
132
|
it 'going to sign in' do
|
81
133
|
visit spree.login_path
|
82
|
-
click_on 'Login with
|
83
|
-
expect(page).to have_text '
|
84
|
-
|
85
|
-
|
86
|
-
|
134
|
+
click_on 'Login with google_oauth2'
|
135
|
+
expect(page).to have_text 'You are now signed in with your google_oauth2 account.'
|
136
|
+
click_link 'Logout'
|
137
|
+
click_link 'Login'
|
138
|
+
click_on 'Login with google_oauth2'
|
139
|
+
expect(page).to have_text 'You are now signed in with your google_oauth2 account.'
|
140
|
+
end
|
141
|
+
|
142
|
+
# Regression test for #91
|
143
|
+
it "attempting to view 'My Account' works" do
|
144
|
+
visit spree.login_path
|
145
|
+
click_on 'Login with google_oauth2'
|
146
|
+
expect(page).to have_text 'You are now signed in with your google_oauth2 account.'
|
147
|
+
click_link 'My Account'
|
148
|
+
expect(page).to have_text 'My Account'
|
149
|
+
end
|
150
|
+
|
151
|
+
it "view 'My Account'" do
|
152
|
+
visit spree.login_path
|
153
|
+
click_on 'Login with google_oauth2'
|
154
|
+
expect(page).to have_text 'You are now signed in with your google_oauth2 account.'
|
155
|
+
click_link 'My Account'
|
156
|
+
expect(page).not_to have_selector 'div#social-signin-links'
|
87
157
|
end
|
88
158
|
end
|
89
159
|
end
|
@@ -6,6 +6,6 @@ RSpec.describe Spree::SocialConfig do
|
|
6
6
|
end
|
7
7
|
|
8
8
|
it "holds configuration for the five default providers" do
|
9
|
-
expect(subject.providers.keys).to match_array([:
|
9
|
+
expect(subject.providers.keys).to match_array([:facebook, :github, :google_oauth2])
|
10
10
|
end
|
11
11
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: solidus_social
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.5.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- John Dyer
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2022-08-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: deface
|
@@ -52,20 +52,6 @@ dependencies:
|
|
52
52
|
- - ">="
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '0'
|
55
|
-
- !ruby/object:Gem::Dependency
|
56
|
-
name: omniauth-amazon
|
57
|
-
requirement: !ruby/object:Gem::Requirement
|
58
|
-
requirements:
|
59
|
-
- - ">="
|
60
|
-
- !ruby/object:Gem::Version
|
61
|
-
version: '0'
|
62
|
-
type: :runtime
|
63
|
-
prerelease: false
|
64
|
-
version_requirements: !ruby/object:Gem::Requirement
|
65
|
-
requirements:
|
66
|
-
- - ">="
|
67
|
-
- !ruby/object:Gem::Version
|
68
|
-
version: '0'
|
69
55
|
- !ruby/object:Gem::Dependency
|
70
56
|
name: omniauth-facebook
|
71
57
|
requirement: !ruby/object:Gem::Requirement
|
@@ -109,7 +95,7 @@ dependencies:
|
|
109
95
|
- !ruby/object:Gem::Version
|
110
96
|
version: '0'
|
111
97
|
- !ruby/object:Gem::Dependency
|
112
|
-
name: omniauth-
|
98
|
+
name: omniauth-rails_csrf_protection
|
113
99
|
requirement: !ruby/object:Gem::Requirement
|
114
100
|
requirements:
|
115
101
|
- - ">="
|
@@ -192,6 +178,7 @@ extra_rdoc_files: []
|
|
192
178
|
files:
|
193
179
|
- ".circleci/config.yml"
|
194
180
|
- ".gem_release.yml"
|
181
|
+
- ".github/dependabot.yml"
|
195
182
|
- ".gitignore"
|
196
183
|
- ".rspec"
|
197
184
|
- ".rubocop.yml"
|
@@ -213,7 +200,6 @@ files:
|
|
213
200
|
- app/decorators/models/solidus_social/spree/user_decorator.rb
|
214
201
|
- app/helpers/spree/omniauth_callbacks_helper.rb
|
215
202
|
- app/models/spree/authentication_method.rb
|
216
|
-
- app/models/spree/social_configuration.rb
|
217
203
|
- app/models/spree/user_authentication.rb
|
218
204
|
- app/overrides/add_authentications_to_account_summary.rb
|
219
205
|
- app/overrides/admin_configuration_decorator.rb
|
@@ -249,6 +235,7 @@ files:
|
|
249
235
|
- lib/solidus_social/engine.rb
|
250
236
|
- lib/solidus_social/facebook_omniauth_strategy_ext.rb
|
251
237
|
- lib/solidus_social/factories.rb
|
238
|
+
- lib/solidus_social/social_configuration.rb
|
252
239
|
- lib/solidus_social/version.rb
|
253
240
|
- solidus_social.gemspec
|
254
241
|
- spec/controllers/spree/omniauth_callbacks_controller_spec.rb
|
@@ -284,7 +271,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
284
271
|
- !ruby/object:Gem::Version
|
285
272
|
version: '0'
|
286
273
|
requirements: []
|
287
|
-
rubygems_version: 3.
|
274
|
+
rubygems_version: 3.3.17
|
288
275
|
signing_key:
|
289
276
|
specification_version: 4
|
290
277
|
summary: Adds social network login services (OAuth) to Solidus
|