solidus_auth_devise 2.5.9 → 2.6.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.
Files changed (87) hide show
  1. checksums.yaml +4 -4
  2. data/.git-blame-ignore-revs +2 -0
  3. data/.github/workflows/test.yml +22 -0
  4. data/.rubocop.yml +0 -8
  5. data/Gemfile +33 -19
  6. data/README.md +1 -1
  7. data/Rakefile +5 -5
  8. data/app/models/spree/user.rb +3 -12
  9. data/app/patches/controllers/solidus_auth_devise/application_controller_patch.rb +29 -0
  10. data/bin/rspec +16 -0
  11. data/config/initializers/devise.rb +7 -5
  12. data/config/routes.rb +31 -31
  13. data/db/default/users.rb +5 -5
  14. data/db/migrate/20101026184949_create_users.rb +19 -19
  15. data/db/migrate/20101026184950_rename_columns_for_devise.rb +1 -3
  16. data/db/migrate/20101214150824_convert_user_remember_field.rb +1 -1
  17. data/db/migrate/20120203010234_add_reset_password_sent_at_to_spree_users.rb +1 -1
  18. data/db/migrate/20120605211305_make_users_email_index_unique.rb +1 -1
  19. data/db/migrate/20140904000425_add_deleted_at_to_users.rb +1 -1
  20. data/db/migrate/20141002154641_add_confirmable_to_users.rb +1 -1
  21. data/db/migrate/20190125170630_add_reset_password_token_index_to_spree_users.rb +3 -3
  22. data/db/migrate/20200417153503_add_unconfirmed_email_to_spree_users.rb +1 -1
  23. data/db/seeds.rb +1 -1
  24. data/lib/controllers/backend/spree/admin/user_passwords_controller.rb +3 -3
  25. data/lib/controllers/backend/spree/admin/user_sessions_controller.rb +7 -7
  26. data/lib/controllers/frontend/spree/user_confirmations_controller.rb +1 -1
  27. data/lib/controllers/frontend/spree/user_passwords_controller.rb +2 -2
  28. data/lib/controllers/frontend/spree/user_registrations_controller.rb +2 -2
  29. data/lib/controllers/frontend/spree/user_sessions_controller.rb +6 -6
  30. data/lib/controllers/frontend/spree/users_controller.rb +5 -4
  31. data/lib/generators/solidus/auth/install/install_generator.rb +7 -7
  32. data/lib/generators/solidus/auth/install/templates/config/initializers/devise.rb.erb +4 -0
  33. data/lib/generators/solidus_auth_devise/install/install_generator.rb +2 -2
  34. data/lib/{decorators/backend/controllers/spree/admin/base_controller_decorator.rb → patches/backend/controllers/solidus_auth_devise/admin/base_controller_patch.rb} +2 -2
  35. data/lib/patches/backend/controllers/solidus_auth_devise/admin/orders/customer_details_controller_patch.rb +28 -0
  36. data/lib/{decorators/frontend/controllers/spree/checkout_controller_decorator.rb → patches/frontend/controllers/solidus_auth_devise/checkout_controller_patch.rb} +7 -7
  37. data/lib/solidus_auth_devise/configuration.rb +1 -1
  38. data/lib/solidus_auth_devise/engine.rb +1 -1
  39. data/lib/solidus_auth_devise/version.rb +1 -1
  40. data/lib/solidus_auth_devise.rb +9 -11
  41. data/lib/spree/auth/engine.rb +10 -15
  42. data/lib/spree/auth/version.rb +1 -1
  43. data/lib/tasks/auth.rake +1 -1
  44. data/solidus_auth_devise.gemspec +20 -21
  45. metadata +19 -96
  46. data/.circleci/config.yml +0 -73
  47. data/.rubocop_todo.yml +0 -397
  48. data/lib/decorators/backend/controllers/spree/admin/orders/customer_details_controller_decorator.rb +0 -22
  49. data/lib/generators/solidus/auth/install/templates/config/initializers/devise.rb +0 -3
  50. data/lib/spree/authentication_helpers.rb +0 -27
  51. data/spec/controllers/spree/admin/base_controller_spec.rb +0 -53
  52. data/spec/controllers/spree/admin/user_passwords_controller_spec.rb +0 -14
  53. data/spec/controllers/spree/admin/user_sessions_controller_spec.rb +0 -20
  54. data/spec/controllers/spree/base_controller_spec.rb +0 -53
  55. data/spec/controllers/spree/checkout_controller_spec.rb +0 -192
  56. data/spec/controllers/spree/products_controller_spec.rb +0 -24
  57. data/spec/controllers/spree/user_passwords_controller_spec.rb +0 -45
  58. data/spec/controllers/spree/user_registrations_controller_spec.rb +0 -97
  59. data/spec/controllers/spree/user_sessions_controller_spec.rb +0 -125
  60. data/spec/controllers/spree/users_controller_spec.rb +0 -79
  61. data/spec/factories/confirmed_user.rb +0 -9
  62. data/spec/features/account_spec.rb +0 -59
  63. data/spec/features/admin/password_reset_spec.rb +0 -80
  64. data/spec/features/admin/products_spec.rb +0 -10
  65. data/spec/features/admin/sign_in_spec.rb +0 -45
  66. data/spec/features/admin/sign_out_spec.rb +0 -42
  67. data/spec/features/admin_permissions_spec.rb +0 -47
  68. data/spec/features/change_email_spec.rb +0 -27
  69. data/spec/features/checkout_spec.rb +0 -158
  70. data/spec/features/confirmation_spec.rb +0 -28
  71. data/spec/features/order_spec.rb +0 -59
  72. data/spec/features/password_reset_spec.rb +0 -37
  73. data/spec/features/sign_in_spec.rb +0 -53
  74. data/spec/features/sign_out_spec.rb +0 -26
  75. data/spec/features/sign_up_spec.rb +0 -31
  76. data/spec/mailers/user_mailer_spec.rb +0 -47
  77. data/spec/models/order_spec.rb +0 -27
  78. data/spec/models/user_spec.rb +0 -103
  79. data/spec/requests/spree/frontend/user_update_spec.rb +0 -42
  80. data/spec/spec_helper.rb +0 -33
  81. data/spec/support/ability.rb +0 -17
  82. data/spec/support/authentication_helpers.rb +0 -16
  83. data/spec/support/confirm_helpers.rb +0 -27
  84. data/spec/support/email.rb +0 -7
  85. data/spec/support/features/fill_addresses_fields.rb +0 -29
  86. data/spec/support/preferences.rb +0 -13
  87. data/spec/support/spree.rb +0 -11
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: '098ee5c680f5383b31766bff2da29911149036a3972e740cc59731c6d05c5f56'
4
- data.tar.gz: 7f6c81439ad91719dc0fe4cee7ba2995370f02d87e1f33d7169472241f50f2c7
3
+ metadata.gz: 84725664c8b934aad5a5bf577d7d3d68780a2de90bbe24ab2ad873072bee53c8
4
+ data.tar.gz: 6ac102f9f5d9003520ea694db1b396f1c5009561a67f0a5ef986623ba8582c1e
5
5
  SHA512:
6
- metadata.gz: 6044f99dbef2b8c35bd664d4a9566a7f7dab506678bed597831f5b818c969647ef72bf00e89395875c64a45f2701ac14c3e7c42d583e292e19ea93595c790bc4
7
- data.tar.gz: 4a44b87bc260b095892bdc0e4477885a7aff5e119c2fac2d3e72c3373db49370b5c05da4d9b824f4d5068df62cbfeaae8d5ff21d27be7550b78f275613785743
6
+ metadata.gz: a9fc38b7508fd7b58025858556c94db80d154bce9e838084b4bf1d30cd36703500194046b57ee7ce34b27c49f725845ef86cf13ea342ed0227df3582c0d9ed2a
7
+ data.tar.gz: ae8963f1294e759c4eeb4cbeceedc526f99635c5d973e0bcbd641f6142124efc88a8204d51cd555426d6ec8b5d727a52bb376967fbe2eb026282001771084cd9
@@ -0,0 +1,2 @@
1
+ # Ignore standardrb --fix commit
2
+ eaba0e4370a03d10a6064466a9197c330bb92c64
@@ -0,0 +1,22 @@
1
+ name: Test
2
+
3
+ on:
4
+ push:
5
+ branches:
6
+ - main
7
+ pull_request:
8
+ schedule:
9
+ - cron: "0 0 * * 4" # every Thursday
10
+
11
+ concurrency:
12
+ group: test-${{ github.ref_name }}
13
+ cancel-in-progress: ${{ github.ref_name != 'main' }}
14
+
15
+ permissions:
16
+ contents: read
17
+
18
+ jobs:
19
+ Test:
20
+ uses: solidusio/test-solidus-extension/.github/workflows/test.yml@v1
21
+ with:
22
+ ruby_versions: "['3.4', '4.0']"
data/.rubocop.yml CHANGED
@@ -1,10 +1,2 @@
1
- inherit_from: .rubocop_todo.yml
2
-
3
1
  require:
4
2
  - solidus_dev_support/rubocop
5
-
6
- AllCops:
7
- NewCops: disable
8
-
9
- Gemspec/RequiredRubyVersion:
10
- Enabled: false
data/Gemfile CHANGED
@@ -1,41 +1,47 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- source 'https://rubygems.org'
3
+ source "https://rubygems.org"
4
4
  git_source(:github) { |repo| "https://github.com/#{repo}.git" }
5
5
 
6
- branch = ENV.fetch('SOLIDUS_BRANCH', 'main')
7
- gem 'solidus', github: 'solidusio/solidus', branch: branch
8
- gem 'solidus_backend', github: 'solidusio/solidus', branch: branch
6
+ branch = ENV.fetch("SOLIDUS_BRANCH", "main")
7
+ gem "solidus", github: "solidusio/solidus", branch: branch
8
+ gem "solidus_backend", github: "solidusio/solidus", branch: branch
9
+
10
+ rails_requirement_string = ENV.fetch("RAILS_VERSION", "7.0")
11
+ gem "rails", "~> #{rails_requirement_string}"
9
12
 
10
13
  # The solidus_frontend gem has been pulled out since v3.2
11
- if branch >= 'v3.2'
12
- gem 'solidus_frontend'
13
- elsif branch == 'main'
14
- gem 'solidus_frontend', github: 'solidusio/solidus_frontend'
14
+ if branch >= "v3.2"
15
+ gem "solidus_frontend"
16
+ elsif branch == "main"
17
+ gem "solidus_frontend", github: "solidusio/solidus_frontend"
15
18
  else
16
- gem 'solidus_frontend', github: 'solidusio/solidus', branch: branch
19
+ gem "solidus_frontend", github: "solidusio/solidus", branch: branch
17
20
  end
18
21
 
19
- case ENV.fetch('DB', nil)
20
- when 'mysql'
21
- gem 'mysql2'
22
- when 'postgresql'
23
- gem 'pg'
22
+ case ENV.fetch("DB", nil)
23
+ when "mysql"
24
+ gem "mysql2"
25
+ when "postgresql"
26
+ gem "pg"
24
27
  else
25
- gem 'sqlite3'
28
+ rails_version = Gem::Requirement.new(rails_requirement_string).requirements[0][1]
29
+ sqlite_version = (rails_version < Gem::Version.new(7.2)) ? "~> 1.4" : "~> 2.0"
30
+
31
+ gem "sqlite3", sqlite_version
26
32
  end
27
33
 
28
- if Gem::Version.new(RUBY_VERSION) < Gem::Version.new('3')
34
+ if Gem::Version.new(RUBY_VERSION) < Gem::Version.new("3")
29
35
  # While we still support Ruby < 3 we need to workaround a limitation in
30
36
  # the 'async' gem that relies on the latest ruby, since RubyGems doesn't
31
37
  # resolve gems based on the required ruby version.
32
- gem 'async', '< 3', require: false
38
+ gem "async", "< 3", require: false
33
39
  end
34
40
 
35
41
  # 'net/smtp' is required by 'mail', see:
36
42
  # - https://github.com/ruby/net-protocol/issues/10
37
43
  # - https://stackoverflow.com/a/72474475
38
- gem 'net-smtp', require: false
44
+ gem "net-smtp", require: false
39
45
 
40
46
  gemspec
41
47
 
@@ -44,4 +50,12 @@ gemspec
44
50
  #
45
51
  # We use `send` instead of calling `eval_gemfile` to work around an issue with
46
52
  # how Dependabot parses projects: https://github.com/dependabot/dependabot-core/issues/1658.
47
- send(:eval_gemfile, 'Gemfile-local') if File.exist? 'Gemfile-local'
53
+ send(:eval_gemfile, "Gemfile-local") if File.exist? "Gemfile-local"
54
+
55
+ # Pin state_machines
56
+ gem "state_machines", "= 0.6.0"
57
+
58
+ if RUBY_VERSION >= "4.0"
59
+ # Necessary for github_changelog_generator
60
+ gem "benchmark", "~> 0.5.0"
61
+ end
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Solidus Auth Devise
2
2
 
3
- [![CircleCI](https://circleci.com/gh/solidusio/solidus_auth_devise.svg?style=shield)](https://circleci.com/gh/solidusio/solidus_auth_devise)
3
+ [![Test](https://github.com/solidusio/solidus_auth_devise/actions/workflows/test.yml/badge.svg)](https://github.com/solidusio/solidus_auth_devise/actions/workflows/test.yml)
4
4
  [![codecov](https://codecov.io/gh/solidusio/solidus_auth_devise/branch/main/graph/badge.svg)](https://codecov.io/gh/solidusio/solidus_auth_devise)
5
5
 
6
6
  Provides authentication services for Solidus, using the Devise gem.
data/Rakefile CHANGED
@@ -1,11 +1,11 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  # Don't build a dummy app with solidus_bolt enabled
4
- ENV['SKIP_SOLIDUS_BOLT'] = 'true'
4
+ ENV["SKIP_SOLIDUS_BOLT"] = "true"
5
5
 
6
- require 'bundler/gem_tasks'
6
+ require "bundler/gem_tasks"
7
7
 
8
- require 'solidus_dev_support/rake_tasks'
9
- SolidusDevSupport::RakeTasks.install
8
+ require "solidus_dev_support/rake_tasks"
9
+ SolidusDevSupport::RakeTasks.install(user_class: "Spree::User")
10
10
 
11
- task default: 'extension:specs'
11
+ task default: "extension:specs"
@@ -3,21 +3,12 @@
3
3
  module Spree
4
4
  class User < Spree::Base
5
5
  include UserMethods
6
+ include Spree::SoftDeletable
6
7
 
7
8
  devise :database_authenticatable, :registerable, :recoverable,
8
- :rememberable, :trackable, :validatable, :encryptable
9
+ :rememberable, :trackable, :validatable, :encryptable
9
10
  devise :confirmable if Spree::Auth::Config[:confirmable]
10
11
 
11
- if defined?(Spree::SoftDeletable)
12
- include Spree::SoftDeletable
13
- else
14
- acts_as_paranoid
15
- include Spree::ParanoiaDeprecations
16
-
17
- include Discard::Model
18
- self.discard_column = :deleted_at
19
- end
20
-
21
12
  after_destroy :scramble_email_and_password
22
13
  after_discard :scramble_email_and_password
23
14
 
@@ -35,7 +26,7 @@ module Spree
35
26
  end
36
27
 
37
28
  def admin?
38
- has_spree_role?('admin')
29
+ has_spree_role?("admin")
39
30
  end
40
31
 
41
32
  def confirmed?
@@ -0,0 +1,29 @@
1
+ # frozen_string_literal: true
2
+
3
+ module SolidusAuthDevise
4
+ module ApplicationControllerPatch
5
+ def self.prepended(base)
6
+ return unless base.respond_to?(:helper_method)
7
+
8
+ base.send(:helper_method, :spree_current_user)
9
+
10
+ return unless SolidusSupport.frontend_available?
11
+
12
+ base.send(:helper_method, :spree_login_path)
13
+ base.send(:helper_method, :spree_signup_path)
14
+ base.send(:helper_method, :spree_logout_path)
15
+ end
16
+
17
+ def spree_current_user
18
+ current_spree_user
19
+ end
20
+
21
+ if SolidusSupport.frontend_available?
22
+ delegate :login_path, :signup_path, :logout_path,
23
+ to: :spree,
24
+ prefix: :spree
25
+ end
26
+
27
+ ApplicationController.prepend self
28
+ end
29
+ end
data/bin/rspec ADDED
@@ -0,0 +1,16 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ #
5
+ # This file was generated by Bundler.
6
+ #
7
+ # The application 'rspec' is installed as part of a gem, and
8
+ # this file is here to facilitate running it.
9
+ #
10
+
11
+ ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../Gemfile", __dir__)
12
+
13
+ require "rubygems"
14
+ require "bundler/setup"
15
+
16
+ load Gem.bin_path("rspec-core", "rspec")
@@ -5,16 +5,16 @@
5
5
  Devise.setup do |config|
6
6
  # ==> Mailer Configuration
7
7
  # Configure the e-mail address which will be shown in DeviseMailer.
8
- config.mailer_sender = 'please-change-me@config-initializers-devise.com'
8
+ config.mailer_sender = "please-change-me@config-initializers-devise.com"
9
9
 
10
10
  # Configure the class responsible to send e-mails.
11
- config.mailer = 'Spree::UserMailer'
11
+ config.mailer = "Spree::UserMailer"
12
12
 
13
13
  # ==> ORM configuration
14
14
  # Load and configure the ORM. Supports :active_record (default) and
15
15
  # :mongoid (bson_ext recommended) by default. Other ORMs may be
16
16
  # available as additional gems.
17
- require 'devise/orm/active_record'
17
+ require "devise/orm/active_record"
18
18
 
19
19
  # ==> Configuration for any authentication mechanism
20
20
  # Configure which keys are used when authenticating an user. By default is
@@ -34,13 +34,13 @@ Devise.setup do |config|
34
34
  # config.http_authenticatable_on_xhr = false
35
35
 
36
36
  # The realm used in Http Basic Authentication
37
- config.http_authentication_realm = 'Spree Application'
37
+ config.http_authentication_realm = "Spree Application"
38
38
 
39
39
  # ==> Configuration for :database_authenticatable
40
40
  # For bcrypt, this is the cost for hashing the password and defaults to 10. If
41
41
  # using other encryptors, it sets how many times you want the password re-encrypted.
42
42
  config.stretches = 20
43
- config.encryptor = 'authlogic_sha512'
43
+ config.encryptor = "authlogic_sha512"
44
44
 
45
45
  # Setup a pepper to generate the encrypted password.
46
46
  config.pepper = if Rails.configuration.respond_to?(:secret_token) && Rails.configuration.secret_token.present?
@@ -143,4 +143,6 @@ Devise.setup do |config|
143
143
  config.reset_password_within = 6.hours
144
144
 
145
145
  config.case_insensitive_keys = [:email]
146
+
147
+ config.reload_routes = false
146
148
  end
data/config/routes.rb CHANGED
@@ -3,15 +3,15 @@
3
3
  Spree::Core::Engine.routes.draw do
4
4
  if SolidusSupport.frontend_available? && Spree::Auth::Config.draw_frontend_routes
5
5
  devise_for(:spree_user, {
6
- class_name: 'Spree::User',
6
+ class_name: "Spree::User",
7
7
  controllers: {
8
- sessions: 'spree/user_sessions',
9
- registrations: 'spree/user_registrations',
10
- passwords: 'spree/user_passwords',
11
- confirmations: 'spree/user_confirmations'
8
+ sessions: "spree/user_sessions",
9
+ registrations: "spree/user_registrations",
10
+ passwords: "spree/user_passwords",
11
+ confirmations: "spree/user_confirmations"
12
12
  },
13
13
  skip: [:unlocks, :omniauth_callbacks],
14
- path_names: { sign_out: 'logout' },
14
+ path_names: {sign_out: "logout"},
15
15
  path_prefix: :user,
16
16
  router_name: :spree
17
17
  })
@@ -19,48 +19,48 @@ Spree::Core::Engine.routes.draw do
19
19
  resources :users, only: [:edit, :update]
20
20
 
21
21
  devise_scope :spree_user do
22
- get '/login', to: 'user_sessions#new', as: :login
23
- post '/login', to: 'user_sessions#create', as: :create_new_session
24
- match '/logout', to: 'user_sessions#destroy', as: :logout, via: Devise.sign_out_via
25
- get '/signup', to: 'user_registrations#new', as: :signup
26
- post '/signup', to: 'user_registrations#create', as: :registration
27
- get '/password/recover', to: 'user_passwords#new', as: :recover_password
28
- post '/password/recover', to: 'user_passwords#create', as: :reset_password
29
- get '/password/change', to: 'user_passwords#edit', as: :edit_password
30
- put '/password/change', to: 'user_passwords#update', as: :update_password
31
- get '/confirm', to: 'user_confirmations#show', as: :confirmation if Spree::Auth::Config[:confirmable]
22
+ get "/login", to: "user_sessions#new", as: :login
23
+ post "/login", to: "user_sessions#create", as: :create_new_session
24
+ match "/logout", to: "user_sessions#destroy", as: :logout, via: Devise.sign_out_via
25
+ get "/signup", to: "user_registrations#new", as: :signup
26
+ post "/signup", to: "user_registrations#create", as: :registration
27
+ get "/password/recover", to: "user_passwords#new", as: :recover_password
28
+ post "/password/recover", to: "user_passwords#create", as: :reset_password
29
+ get "/password/change", to: "user_passwords#edit", as: :edit_password
30
+ put "/password/change", to: "user_passwords#update", as: :update_password
31
+ get "/confirm", to: "user_confirmations#show", as: :confirmation if Spree::Auth::Config[:confirmable]
32
32
  end
33
33
 
34
- get '/checkout/registration', to: 'checkout#registration', as: :checkout_registration
35
- put '/checkout/registration', to: 'checkout#update_registration', as: :update_checkout_registration
34
+ get "/checkout/registration", to: "checkout#registration", as: :checkout_registration
35
+ put "/checkout/registration", to: "checkout#update_registration", as: :update_checkout_registration
36
36
 
37
- resource :account, controller: 'users'
37
+ resource :account, controller: "users"
38
38
  end
39
39
 
40
40
  if SolidusSupport.backend_available? && Spree::Auth::Config.draw_backend_routes
41
41
  namespace :admin do
42
42
  devise_for(:spree_user, {
43
- class_name: 'Spree::User',
43
+ class_name: "Spree::User",
44
44
  singular: :spree_user,
45
45
  skip: :all,
46
- path_names: { sign_out: 'logout' },
46
+ path_names: {sign_out: "logout"},
47
47
  controllers: {
48
- sessions: 'spree/admin/user_sessions',
49
- passwords: 'spree/admin/user_passwords'
48
+ sessions: "spree/admin/user_sessions",
49
+ passwords: "spree/admin/user_passwords"
50
50
  },
51
51
  router_name: :spree
52
52
  })
53
53
 
54
54
  devise_scope :spree_user do
55
- get '/authorization_failure', to: 'user_sessions#authorization_failure', as: :unauthorized
56
- get '/login', to: 'user_sessions#new', as: :login
57
- post '/login', to: 'user_sessions#create', as: :create_new_session
58
- match '/logout', to: 'user_sessions#destroy', as: :logout, via: Devise.sign_out_via
55
+ get "/authorization_failure", to: "user_sessions#authorization_failure", as: :unauthorized
56
+ get "/login", to: "user_sessions#new", as: :login
57
+ post "/login", to: "user_sessions#create", as: :create_new_session
58
+ match "/logout", to: "user_sessions#destroy", as: :logout, via: Devise.sign_out_via
59
59
 
60
- get '/password/recover', to: 'user_passwords#new', as: :recover_password
61
- post '/password/recover', to: 'user_passwords#create', as: :reset_password
62
- get '/password/change', to: 'user_passwords#edit', as: :edit_password
63
- put '/password/change', to: 'user_passwords#update', as: :update_password
60
+ get "/password/recover", to: "user_passwords#new", as: :recover_password
61
+ post "/password/recover", to: "user_passwords#create", as: :reset_password
62
+ get "/password/change", to: "user_passwords#edit", as: :edit_password
63
+ put "/password/change", to: "user_passwords#update", as: :update_password
64
64
  end
65
65
  end
66
66
  end
data/db/default/users.rb CHANGED
@@ -1,14 +1,14 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- admin_role = Spree::Role.find_or_create_by(name: 'admin')
3
+ admin_role = Spree::Role.find_or_create_by(name: "admin")
4
4
 
5
5
  if Spree::User.admin.any?
6
- puts 'No admin user created.'
6
+ puts "No admin user created."
7
7
  return
8
8
  end
9
9
 
10
- email = ENV['ADMIN_EMAIL'] || 'admin@example.com'
11
- password = ENV['ADMIN_PASSWORD'] || 'test123'
10
+ email = ENV["ADMIN_EMAIL"] || "admin@example.com"
11
+ password = ENV["ADMIN_PASSWORD"] || "test123"
12
12
 
13
13
  puts "Creating admin user with:"
14
14
  puts " - email: #{email}"
@@ -24,7 +24,7 @@ admin = Spree::User.new(
24
24
  password: password,
25
25
  password_confirmation: password,
26
26
  email: email,
27
- login: email,
27
+ login: email
28
28
  )
29
29
 
30
30
  if admin.save
@@ -1,30 +1,30 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- class CreateUsers < SolidusSupport::Migration[4.2]
3
+ class CreateUsers < ActiveRecord::Migration[4.2]
4
4
  def up
5
5
  unless table_exists?("spree_users")
6
6
  create_table "spree_users", force: true do |t|
7
- t.string "crypted_password", limit: 128
8
- t.string "salt", limit: 128
9
- t.string "email"
10
- t.string "remember_token"
11
- t.string "remember_token_expires_at"
12
- t.string "persistence_token"
13
- t.string "single_access_token"
14
- t.string "perishable_token"
15
- t.integer "login_count", default: 0, null: false
16
- t.integer "failed_login_count", default: 0, null: false
7
+ t.string "crypted_password", limit: 128
8
+ t.string "salt", limit: 128
9
+ t.string "email"
10
+ t.string "remember_token"
11
+ t.string "remember_token_expires_at"
12
+ t.string "persistence_token"
13
+ t.string "single_access_token"
14
+ t.string "perishable_token"
15
+ t.integer "login_count", default: 0, null: false
16
+ t.integer "failed_login_count", default: 0, null: false
17
17
  t.datetime "last_request_at"
18
18
  t.datetime "current_login_at"
19
19
  t.datetime "last_login_at"
20
- t.string "current_login_ip"
21
- t.string "last_login_ip"
22
- t.string "login"
23
- t.integer "ship_address_id"
24
- t.integer "bill_address_id"
25
- t.datetime "created_at", null: false
26
- t.datetime "updated_at", null: false
27
- t.string "openid_identifier"
20
+ t.string "current_login_ip"
21
+ t.string "last_login_ip"
22
+ t.string "login"
23
+ t.integer "ship_address_id"
24
+ t.integer "bill_address_id"
25
+ t.datetime "created_at", null: false
26
+ t.datetime "updated_at", null: false
27
+ t.string "openid_identifier"
28
28
  end
29
29
  end
30
30
  end
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- class RenameColumnsForDevise < SolidusSupport::Migration[4.2]
3
+ class RenameColumnsForDevise < ActiveRecord::Migration[4.2]
4
4
  def up
5
5
  return if column_exists?(:spree_users, :password_salt)
6
6
 
@@ -14,14 +14,12 @@ class RenameColumnsForDevise < SolidusSupport::Migration[4.2]
14
14
  rename_column :spree_users, :last_login_at, :last_sign_in_at
15
15
  rename_column :spree_users, :current_login_ip, :current_sign_in_ip
16
16
  rename_column :spree_users, :last_login_ip, :last_sign_in_ip
17
- add_column :spree_users, :authentication_token, :string
18
17
  add_column :spree_users, :unlock_token, :string
19
18
  add_column :spree_users, :locked_at, :datetime
20
19
  remove_column :spree_users, :openid_identifier
21
20
  end
22
21
 
23
22
  def down
24
- remove_column :spree_users, :authentication_token
25
23
  remove_column :spree_users, :locked_at
26
24
  remove_column :spree_users, :unlock_token
27
25
  rename_column :spree_users, :last_sign_in_ip, :last_login_ip
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- class ConvertUserRememberField < SolidusSupport::Migration[4.2]
3
+ class ConvertUserRememberField < ActiveRecord::Migration[4.2]
4
4
  def up
5
5
  remove_column :spree_users, :remember_created_at
6
6
  add_column :spree_users, :remember_created_at, :datetime
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- class AddResetPasswordSentAtToSpreeUsers < SolidusSupport::Migration[4.2]
3
+ class AddResetPasswordSentAtToSpreeUsers < ActiveRecord::Migration[4.2]
4
4
  def change
5
5
  Spree::User.reset_column_information
6
6
  unless Spree::User.column_names.include?("reset_password_sent_at")
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- class MakeUsersEmailIndexUnique < SolidusSupport::Migration[4.2]
3
+ class MakeUsersEmailIndexUnique < ActiveRecord::Migration[4.2]
4
4
  def up
5
5
  add_index "spree_users", ["email"], name: "email_idx_unique", unique: true
6
6
  end
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- class AddDeletedAtToUsers < SolidusSupport::Migration[4.2]
3
+ class AddDeletedAtToUsers < ActiveRecord::Migration[4.2]
4
4
  def change
5
5
  add_column :spree_users, :deleted_at, :datetime
6
6
  add_index :spree_users, :deleted_at
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- class AddConfirmableToUsers < SolidusSupport::Migration[4.2]
3
+ class AddConfirmableToUsers < ActiveRecord::Migration[4.2]
4
4
  def change
5
5
  add_column :spree_users, :confirmation_token, :string
6
6
  add_column :spree_users, :confirmed_at, :datetime
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- class AddResetPasswordTokenIndexToSpreeUsers < SolidusSupport::Migration[4.2]
3
+ class AddResetPasswordTokenIndexToSpreeUsers < ActiveRecord::Migration[4.2]
4
4
  # We're not using the standard Rails index name because somebody could have
5
5
  #  already added that index to the table. By using a custom name we ensure
6
6
  # that the index can effectively be added and removed via migrations/rollbacks
@@ -8,7 +8,7 @@ class AddResetPasswordTokenIndexToSpreeUsers < SolidusSupport::Migration[4.2]
8
8
  # standard name + "_solidus_auth_devise"; the length is 61 chars which is
9
9
  # still OK for Sqlite, mySQL and Postgres.
10
10
  def custom_index_name
11
- 'index_spree_users_on_reset_password_token_solidus_auth_devise'
11
+ "index_spree_users_on_reset_password_token_solidus_auth_devise"
12
12
  end
13
13
 
14
14
  def default_index_exists?
@@ -21,7 +21,7 @@ class AddResetPasswordTokenIndexToSpreeUsers < SolidusSupport::Migration[4.2]
21
21
 
22
22
  def up
23
23
  Spree::User.reset_column_information
24
- if Spree::User.column_names.include?('reset_password_token') && !default_index_exists? && !custom_index_exists?
24
+ if Spree::User.column_names.include?("reset_password_token") && !default_index_exists? && !custom_index_exists?
25
25
  add_index :spree_users, :reset_password_token, unique: true, name: custom_index_name
26
26
  end
27
27
  end
@@ -1,4 +1,4 @@
1
- class AddUnconfirmedEmailToSpreeUsers < SolidusSupport::Migration[5.1]
1
+ class AddUnconfirmedEmailToSpreeUsers < ActiveRecord::Migration[5.1]
2
2
  def change
3
3
  unless column_exists?(:spree_users, :unconfirmed_email)
4
4
  add_column :spree_users, :unconfirmed_email, :string
data/db/seeds.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require_relative 'default/users.rb'
3
+ require_relative "default/users"
@@ -1,14 +1,14 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  class Spree::Admin::UserPasswordsController < Devise::PasswordsController
4
- helper 'spree/base'
4
+ helper "spree/base"
5
5
 
6
6
  include Spree::Core::ControllerHelpers::Auth
7
7
  include Spree::Core::ControllerHelpers::Common
8
8
  include Spree::Core::ControllerHelpers::Store
9
9
 
10
- helper 'spree/admin/navigation'
11
- layout 'spree/layouts/admin'
10
+ helper "spree/admin/navigation"
11
+ layout "spree/layouts/admin"
12
12
 
13
13
  skip_before_action :require_no_authentication, only: [:create]
14
14
 
@@ -1,14 +1,14 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  class Spree::Admin::UserSessionsController < Devise::SessionsController
4
- helper 'spree/base'
4
+ helper "spree/base"
5
5
 
6
6
  include Spree::Core::ControllerHelpers::Auth
7
7
  include Spree::Core::ControllerHelpers::Common
8
8
  include Spree::Core::ControllerHelpers::Store
9
9
 
10
- helper 'spree/admin/navigation'
11
- layout 'spree/layouts/admin'
10
+ helper "spree/admin/navigation"
11
+ layout "spree/layouts/admin"
12
12
 
13
13
  def create
14
14
  authenticate_spree_user!
@@ -16,16 +16,16 @@ class Spree::Admin::UserSessionsController < Devise::SessionsController
16
16
  if spree_user_signed_in?
17
17
  respond_to do |format|
18
18
  format.html {
19
- flash[:success] = I18n.t('spree.logged_in_succesfully')
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
  }
22
22
  format.js {
23
23
  user = resource.record
24
- render json: { ship_address: user.ship_address, bill_address: user.bill_address }.to_json
24
+ render json: {ship_address: user.ship_address, bill_address: user.bill_address}.to_json
25
25
  }
26
26
  end
27
27
  else
28
- flash.now[:error] = t('devise.failure.invalid')
28
+ flash.now[:error] = t("devise.failure.invalid")
29
29
  render :new
30
30
  end
31
31
  end
@@ -49,7 +49,7 @@ class Spree::Admin::UserSessionsController < Devise::SessionsController
49
49
  end
50
50
 
51
51
  def accurate_title
52
- I18n.t('spree.login')
52
+ I18n.t("spree.login")
53
53
  end
54
54
 
55
55
  def redirect_back_or_default(default)