solidus_auth_devise 2.5.6 → 2.5.7

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 7714facb5fe5f4230194a4680c5f63a5f3257726811ec9a2ac337f96b20b297a
4
- data.tar.gz: fac0bd47a9a25e211bf56135a334e5f1e3b9525513f290b0b18016e8d5409446
3
+ metadata.gz: 2af5db5a4a28f17bc5159f1ccae8e0a6ad3f54aee0c03150a750a76129d89be7
4
+ data.tar.gz: 69aef17ae84f348294dff74150a24845a3924d8ec6258c3f230d61967e496c82
5
5
  SHA512:
6
- metadata.gz: eb4378a3029e4db8ba943cdb5a4a54fe5b2303a8d2dfe07d8cc7e4b16609987aa9927b5a84b47844cf5122652899a77293a25440f49f42bb65d1b38711d063e8
7
- data.tar.gz: 0332cdb250463314283e1ee3da8c3ed2ce697d0851d6c3aef946183d53c647f1d533a3f8793567fe43d15d07451890104142faaeb9b5ce74e651a7dc5f83dafb
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-memory
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.5](https://github.com/solidusio/solidus_auth_devise/tree/v2.5.5) (2022-09-19)
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.4...v2.5.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
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
- if %w[g generate].include? ARGV.first
3
+ if %w[g generate].include?(ARGV.first) && ARGV[1] !~ /^(solidus:auth:|solidus_auth_devise:)/
4
4
  exec "#{__dir__}/rails-engine", *ARGV
5
5
  else
6
6
  exec "#{__dir__}/rails-sandbox", *ARGV
data/bin/sandbox CHANGED
@@ -71,6 +71,7 @@ cat <<RUBY >> Gemfile
71
71
  gem 'solidus', github: 'solidusio/solidus', branch: '$BRANCH'
72
72
  gem 'rails-i18n'
73
73
  gem 'solidus_i18n'
74
+ gem 'net-smtp', require: false
74
75
 
75
76
  gem '$extension_name', path: '..'
76
77
 
data/db/default/users.rb CHANGED
@@ -1,78 +1,38 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- # see last line where we create an admin if there is none, asking for email and password
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
- password
5
+ if Spree::User.admin.any?
6
+ puts 'No admin user created.'
7
+ return
15
8
  end
16
9
 
17
- def prompt_for_admin_email
18
- if ENV['ADMIN_EMAIL']
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
- email
28
- end
29
-
30
- def create_admin_user
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
- if Spree::User.find_by(email: email)
50
- puts "\nWARNING: There is already a user with the email: #{email}, so no account changes were made. If you wish to create an additional admin user, please run rake spree_auth:admin:create again with a different email.\n\n"
51
- else
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
- if Spree::User.admin.empty?
69
- create_admin_user
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
- puts 'Admin user has already been created.'
72
- puts 'Would you like to create a new admin user? (yes/no)'
73
- if ["yes", "y"].include? STDIN.gets.strip.downcase
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, default: false
8
- class_option :skip_migrations, type: :boolean, default: false
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
- def self.source_paths
11
- paths = superclass.source_paths
12
- paths << File.expand_path('templates', __dir__)
13
- paths.flatten
14
- end
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
- run 'bundle exec rake railties:install:migrations FROM=solidus_auth'
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
- return if options[:skip_migrations]
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
- run_migrations = options[:auto_run_migrations] || ['', 'y', 'Y'].include?(ask('Would you like to run the migrations now? [Y/n]'))
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
- puts 'Skipping rake db:migrate, don\'t forget to run it!' # rubocop:disable Rails/Output
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 = ::Solidus::Auth::Generators::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
@@ -1,7 +1,3 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require 'spree/auth/engine'
4
-
5
- module SolidusAuthDevise
6
- Engine = ::Spree::Auth::Engine
7
- end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module SolidusAuthDevise
4
- VERSION = '2.5.6'
4
+ VERSION = '2.5.7'
5
5
  end
@@ -95,3 +95,5 @@ module Spree
95
95
  end
96
96
  end
97
97
  end
98
+
99
+ SolidusAuthDevise::Engine = Spree::Auth::Engine
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.6
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-09-30 00:00:00.000000000 Z
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.2.32
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.