solidus_auth_devise 2.5.6 → 2.5.7
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 +4 -5
- data/CHANGELOG.md +15 -4
- data/Gemfile +5 -5
- data/bin/rails +1 -1
- data/bin/sandbox +1 -0
- data/db/default/users.rb +27 -67
- data/lib/generators/solidus/auth/install/install_generator.rb +20 -13
- data/lib/generators/solidus_auth_devise/install/install_generator.rb +11 -1
- data/lib/solidus_auth_devise/engine.rb +0 -4
- data/lib/solidus_auth_devise/version.rb +1 -1
- data/lib/spree/auth/engine.rb +2 -0
- metadata +7 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2af5db5a4a28f17bc5159f1ccae8e0a6ad3f54aee0c03150a750a76129d89be7
|
4
|
+
data.tar.gz: 69aef17ae84f348294dff74150a24845a3924d8ec6258c3f230d61967e496c82
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 171dd785ee3843aed488389a69049dbdf435c4df7ab7ba72e1d5be820b26a7cb422a531716afcbeaead38381e4a1efdab4197b232632ef9dd8066439c24a5918
|
7
|
+
data.tar.gz: 8b5f64a426df8e2ee9f7efbad70c7faecffc57968e9c4242b3bbd0a44ef77498781422bc6c3f63c90924fa626edc9018416585342557485b742b0f66a54b0afd
|
data/.circleci/config.yml
CHANGED
@@ -16,8 +16,8 @@ jobs:
|
|
16
16
|
name: solidusio_extensions/postgres
|
17
17
|
ruby_version: '3.1'
|
18
18
|
steps:
|
19
|
-
- browser-tools/install-browser-tools
|
20
19
|
- checkout
|
20
|
+
- browser-tools/install-chrome
|
21
21
|
- solidusio_extensions/run-tests-solidus-master
|
22
22
|
- solidusio_extensions/store-test-results
|
23
23
|
|
@@ -26,8 +26,8 @@ jobs:
|
|
26
26
|
name: solidusio_extensions/mysql
|
27
27
|
ruby_version: '3.0'
|
28
28
|
steps:
|
29
|
-
- browser-tools/install-browser-tools
|
30
29
|
- checkout
|
30
|
+
- browser-tools/install-chrome
|
31
31
|
- solidusio_extensions/run-tests-solidus-current
|
32
32
|
- solidusio_extensions/store-test-results
|
33
33
|
|
@@ -36,15 +36,14 @@ jobs:
|
|
36
36
|
name: solidusio_extensions/sqlite
|
37
37
|
ruby_version: '2.7'
|
38
38
|
steps:
|
39
|
-
- browser-tools/install-browser-tools
|
40
39
|
- checkout
|
40
|
+
- browser-tools/install-chrome
|
41
41
|
- solidusio_extensions/run-tests-solidus-older
|
42
42
|
- solidusio_extensions/store-test-results
|
43
43
|
|
44
44
|
lint-code:
|
45
|
-
executor: solidusio_extensions/sqlite
|
45
|
+
executor: solidusio_extensions/sqlite
|
46
46
|
steps:
|
47
|
-
- browser-tools/install-browser-tools
|
48
47
|
- solidusio_extensions/lint-code
|
49
48
|
|
50
49
|
workflows:
|
data/CHANGELOG.md
CHANGED
@@ -1,11 +1,20 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
|
-
## [v2.5.
|
3
|
+
## [v2.5.7](https://github.com/solidusio/solidus_auth_devise/tree/v2.5.7) (2022-10-31)
|
4
4
|
|
5
|
-
[Full Changelog](https://github.com/solidusio/solidus_auth_devise/compare/v2.5.
|
5
|
+
[Full Changelog](https://github.com/solidusio/solidus_auth_devise/compare/v2.5.6...v2.5.7)
|
6
|
+
|
7
|
+
**Merged pull requests:**
|
8
|
+
|
9
|
+
- Fix the standard generator alias and remove interactivity from seeds [\#233](https://github.com/solidusio/solidus_auth_devise/pull/233) ([elia](https://github.com/elia))
|
10
|
+
|
11
|
+
## [v2.5.6](https://github.com/solidusio/solidus_auth_devise/tree/v2.5.6) (2022-09-30)
|
12
|
+
|
13
|
+
[Full Changelog](https://github.com/solidusio/solidus_auth_devise/compare/v2.5.5...v2.5.6)
|
6
14
|
|
7
15
|
**Merged pull requests:**
|
8
16
|
|
17
|
+
- Revert "Utilize Devise location helpers for redirecting" [\#232](https://github.com/solidusio/solidus_auth_devise/pull/232) ([elia](https://github.com/elia))
|
9
18
|
- Run the CI on all supported ruby versions [\#229](https://github.com/solidusio/solidus_auth_devise/pull/229) ([elia](https://github.com/elia))
|
10
19
|
- Utilize Devise location helpers for redirecting [\#228](https://github.com/solidusio/solidus_auth_devise/pull/228) ([cpfergus1](https://github.com/cpfergus1))
|
11
20
|
- Update to use forked solidus\_frontend when needed [\#227](https://github.com/solidusio/solidus_auth_devise/pull/227) ([waiting-for-dev](https://github.com/waiting-for-dev))
|
@@ -16,12 +25,14 @@
|
|
16
25
|
- Update to the latest solidus\_dev\_support defaults [\#220](https://github.com/solidusio/solidus_auth_devise/pull/220) ([elia](https://github.com/elia))
|
17
26
|
- Fix build [\#219](https://github.com/solidusio/solidus_auth_devise/pull/219) ([gsmendoza](https://github.com/gsmendoza))
|
18
27
|
|
28
|
+
## [v2.5.5](https://github.com/solidusio/solidus_auth_devise/tree/v2.5.5) (2022-09-19)
|
29
|
+
|
30
|
+
[Full Changelog](https://github.com/solidusio/solidus_auth_devise/compare/v2.5.4...v2.5.5)
|
31
|
+
|
19
32
|
## [v2.5.4](https://github.com/solidusio/solidus_auth_devise/tree/v2.5.4) (2021-11-17)
|
20
33
|
|
21
34
|
[Full Changelog](https://github.com/solidusio/solidus_auth_devise/compare/v2.5.3...v2.5.4)
|
22
35
|
|
23
|
-
- Fix authentication bypass by CSRF weakness [GHSA-xm34-v85h-9pg2](https://github.com/solidusio/solidus_auth_devise/security/advisories/GHSA-xm34-v85h-9pg2)
|
24
|
-
|
25
36
|
**Closed issues:**
|
26
37
|
|
27
38
|
- This line doesn't do anything [\#214](https://github.com/solidusio/solidus_auth_devise/issues/214)
|
data/Gemfile
CHANGED
@@ -25,13 +25,13 @@ if Gem::Version.new(RUBY_VERSION) < Gem::Version.new('3')
|
|
25
25
|
# the 'async' gem that relies on the latest ruby, since RubyGems doesn't
|
26
26
|
# resolve gems based on the required ruby version.
|
27
27
|
gem 'async', '< 3', require: false
|
28
|
-
|
29
|
-
# 'net/smtp' is required by 'mail', see:
|
30
|
-
# - https://github.com/ruby/net-protocol/issues/10
|
31
|
-
# - https://stackoverflow.com/a/72474475
|
32
|
-
gem 'net-smtp', require: false
|
33
28
|
end
|
34
29
|
|
30
|
+
# 'net/smtp' is required by 'mail', see:
|
31
|
+
# - https://github.com/ruby/net-protocol/issues/10
|
32
|
+
# - https://stackoverflow.com/a/72474475
|
33
|
+
gem 'net-smtp', require: false
|
34
|
+
|
35
35
|
gemspec
|
36
36
|
|
37
37
|
# Use a local Gemfile to include development dependencies that might not be
|
data/bin/rails
CHANGED
data/bin/sandbox
CHANGED
data/db/default/users.rb
CHANGED
@@ -1,78 +1,38 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
|
4
|
-
def prompt_for_admin_password
|
5
|
-
if ENV['ADMIN_PASSWORD']
|
6
|
-
password = ENV['ADMIN_PASSWORD'].dup
|
7
|
-
puts "Admin Password #{password}"
|
8
|
-
else
|
9
|
-
print "Password [test123]: "
|
10
|
-
password = STDIN.gets.strip
|
11
|
-
password = 'test123' if password.blank?
|
12
|
-
end
|
3
|
+
admin_role = Spree::Role.find_or_create_by(name: 'admin')
|
13
4
|
|
14
|
-
|
5
|
+
if Spree::User.admin.any?
|
6
|
+
puts 'No admin user created.'
|
7
|
+
return
|
15
8
|
end
|
16
9
|
|
17
|
-
|
18
|
-
|
19
|
-
email = ENV['ADMIN_EMAIL'].dup
|
20
|
-
puts "Admin User #{email}"
|
21
|
-
else
|
22
|
-
print "Email [admin@example.com]: "
|
23
|
-
email = STDIN.gets.strip
|
24
|
-
email = 'admin@example.com' if email.blank?
|
25
|
-
end
|
10
|
+
email = ENV['ADMIN_EMAIL'] || 'admin@example.com'
|
11
|
+
password = ENV['ADMIN_PASSWORD'] || 'test123'
|
26
12
|
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
if ENV['AUTO_ACCEPT']
|
32
|
-
password = 'test123'
|
33
|
-
email = 'admin@example.com'
|
34
|
-
else
|
35
|
-
puts 'Create the admin user (press enter for defaults).'
|
36
|
-
# name = prompt_for_admin_name unless name
|
37
|
-
email = prompt_for_admin_email
|
38
|
-
password = prompt_for_admin_password
|
39
|
-
end
|
40
|
-
attributes = {
|
41
|
-
password: password,
|
42
|
-
password_confirmation: password,
|
43
|
-
email: email,
|
44
|
-
login: email
|
45
|
-
}
|
46
|
-
|
47
|
-
load 'spree/user.rb'
|
13
|
+
puts "Creating admin user with:"
|
14
|
+
puts " - email: #{email}"
|
15
|
+
puts " - password: #{password}"
|
16
|
+
puts "(please use the ADMIN_EMAIL and ADMIN_PASSWORD environment variables to control how the default admin user is created)"
|
48
17
|
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
admin = Spree::User.new(attributes)
|
53
|
-
if admin.save
|
54
|
-
role = Spree::Role.find_or_create_by(name: 'admin')
|
55
|
-
admin.spree_roles << role
|
56
|
-
admin.save
|
57
|
-
admin.generate_spree_api_key!
|
58
|
-
puts "Done!"
|
59
|
-
else
|
60
|
-
puts "There were some problems with persisting a new admin user:"
|
61
|
-
admin.errors.full_messages.each do |error|
|
62
|
-
puts error
|
63
|
-
end
|
64
|
-
end
|
65
|
-
end
|
18
|
+
if Spree::User.find_by(email: email)
|
19
|
+
warn "WARNING: There is already a user with the email: #{email}, so no account changes were made."
|
20
|
+
return
|
66
21
|
end
|
67
22
|
|
68
|
-
|
69
|
-
|
23
|
+
admin = Spree::User.new(
|
24
|
+
password: password,
|
25
|
+
password_confirmation: password,
|
26
|
+
email: email,
|
27
|
+
login: email,
|
28
|
+
)
|
29
|
+
|
30
|
+
if admin.save
|
31
|
+
admin.spree_roles << admin_role
|
32
|
+
admin.save
|
33
|
+
admin.generate_spree_api_key!
|
70
34
|
else
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
create_admin_user
|
75
|
-
else
|
76
|
-
puts 'No admin user created.'
|
77
|
-
end
|
35
|
+
warn "There were some problems while creating the admin user:"
|
36
|
+
warn(admin.errors.full_messages.map { |m| "- #{m}" })
|
37
|
+
warn "(attributes: #{admin.attributes.inspect})"
|
78
38
|
end
|
@@ -4,31 +4,38 @@ module Solidus
|
|
4
4
|
module Auth
|
5
5
|
module Generators
|
6
6
|
class InstallGenerator < Rails::Generators::Base
|
7
|
-
class_option :auto_run_migrations, type: :boolean,
|
8
|
-
class_option :skip_migrations, type: :boolean,
|
7
|
+
class_option :auto_run_migrations, type: :boolean, desc: "Run migrations automatically"
|
8
|
+
class_option :skip_migrations, type: :boolean, desc: "Skip migrations"
|
9
9
|
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
10
|
+
class_option :interactive, type: :boolean, default: false, desc: "Enable interactive mode"
|
11
|
+
class_option :admin_email, type: :string
|
12
|
+
class_option :admin_password, type: :string
|
13
|
+
|
14
|
+
source_root "#{__dir__}/templates"
|
15
15
|
|
16
16
|
def generate_devise_key
|
17
17
|
template 'config/initializers/devise.rb', 'config/initializers/devise.rb', skip: true
|
18
18
|
end
|
19
19
|
|
20
20
|
def add_migrations
|
21
|
-
|
21
|
+
admin_email = options[:admin_email] || (options[:interactive] && ask("Email:", default: 'admin@example.com'))
|
22
|
+
admin_password = options[:admin_password] || (options[:interactive] && ask("Password:", default: 'test123'))
|
23
|
+
|
24
|
+
options = []
|
25
|
+
options << "ADMIN_EMAIL=#{admin_email}" if admin_email
|
26
|
+
options << "ADMIN_PASSWORD=#{admin_password}" if admin_password
|
27
|
+
|
28
|
+
rake "railties:install:migrations FROM=solidus_auth #{options.shelljoin}"
|
22
29
|
end
|
23
30
|
|
24
31
|
def run_migrations
|
25
|
-
|
32
|
+
if options[:skip_migrations] ||
|
33
|
+
options[:auto_run_migrations] == false || # exclude nil
|
34
|
+
options[:interactive] && no?('Would you like to run the migrations now?')
|
26
35
|
|
27
|
-
|
28
|
-
if run_migrations
|
29
|
-
run 'bundle exec rake db:migrate'
|
36
|
+
say_status :skip, 'Skipping rake db:migrate, don\'t forget to run it!', :yellow
|
30
37
|
else
|
31
|
-
|
38
|
+
rake 'db:migrate'
|
32
39
|
end
|
33
40
|
end
|
34
41
|
end
|
@@ -1,8 +1,18 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
require_relative '../../solidus/auth/install/install_generator'
|
4
|
+
|
4
5
|
module SolidusAuthDevise
|
5
6
|
module Generators
|
6
|
-
InstallGenerator
|
7
|
+
class InstallGenerator < Rails::Generators::Base
|
8
|
+
# Copy over any class option from the legacy install generator
|
9
|
+
Solidus::Auth::Generators::InstallGenerator.class_options.each do |name, option|
|
10
|
+
class_options[name] ||= option.dup
|
11
|
+
end
|
12
|
+
|
13
|
+
def forward_to_spree_auth_install
|
14
|
+
generate 'solidus:auth:install', *ARGV
|
15
|
+
end
|
16
|
+
end
|
7
17
|
end
|
8
18
|
end
|
data/lib/spree/auth/engine.rb
CHANGED
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.5.
|
4
|
+
version: 2.5.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Solidus Team
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-
|
11
|
+
date: 2022-10-31 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: deface
|
@@ -142,7 +142,7 @@ dependencies:
|
|
142
142
|
- - ">="
|
143
143
|
- !ruby/object:Gem::Version
|
144
144
|
version: '0'
|
145
|
-
description:
|
145
|
+
description:
|
146
146
|
email: contact@solidus.io
|
147
147
|
executables: []
|
148
148
|
extensions: []
|
@@ -283,7 +283,7 @@ metadata:
|
|
283
283
|
homepage_uri: https://github.com/solidusio/solidus_auth_devise
|
284
284
|
source_code_uri: https://github.com/solidusio/solidus_auth_devise
|
285
285
|
changelog_uri: https://github.com/solidusio/solidus_auth_devise/blob/master/CHANGELOG.md
|
286
|
-
post_install_message:
|
286
|
+
post_install_message:
|
287
287
|
rdoc_options: []
|
288
288
|
require_paths:
|
289
289
|
- lib
|
@@ -301,8 +301,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
301
301
|
- !ruby/object:Gem::Version
|
302
302
|
version: '0'
|
303
303
|
requirements: []
|
304
|
-
rubygems_version: 3.
|
305
|
-
signing_key:
|
304
|
+
rubygems_version: 3.3.7
|
305
|
+
signing_key:
|
306
306
|
specification_version: 4
|
307
307
|
summary: Provides authentication and authorization services for use with Solidus by
|
308
308
|
using Devise and CanCan.
|