diff --git a/README.md b/README.md index 4f6f54ec..39423cd8 100644 --- a/README.md +++ b/README.md @@ -36,7 +36,7 @@ To enable Devise's Confirmable module, which will send the user an email with a * Add this line to an initializer in your Rails project (typically `config/initializers/spree.rb`): ```ruby -Spree::Auth::Config[:confirmable] = true +Spree::Auth::Config.confirmable = true ``` * Add a Devise initializer to your Rails project (typically `config/initializers/devise.rb`): diff --git a/app/models/spree/user.rb b/app/models/spree/user.rb index 90c76f60..6c9c1ce2 100644 --- a/app/models/spree/user.rb +++ b/app/models/spree/user.rb @@ -7,7 +7,7 @@ class User < Spree::Base devise :database_authenticatable, :registerable, :recoverable, :rememberable, :trackable, :validatable, :encryptable - devise :confirmable if Spree::Auth::Config[:confirmable] + devise :confirmable if Spree::Auth::Config.confirmable after_destroy :scramble_email_and_password after_discard :scramble_email_and_password diff --git a/config/routes.rb b/config/routes.rb index 18d3c3c2..02d61bef 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -28,7 +28,7 @@ post "/password/recover", to: "user_passwords#create", as: :reset_password get "/password/change", to: "user_passwords#edit", as: :edit_password put "/password/change", to: "user_passwords#update", as: :update_password - get "/confirm", to: "user_confirmations#show", as: :confirmation if Spree::Auth::Config[:confirmable] + get "/confirm", to: "user_confirmations#show", as: :confirmation if Spree::Auth::Config.confirmable end get "/checkout/registration", to: "checkout#registration", as: :checkout_registration diff --git a/lib/controllers/frontend/spree/users_controller.rb b/lib/controllers/frontend/spree/users_controller.rb index 531c4bd6..9a546643 100644 --- a/lib/controllers/frontend/spree/users_controller.rb +++ b/lib/controllers/frontend/spree/users_controller.rb @@ -38,7 +38,7 @@ def update if params[:user][:password].present? # this logic needed b/c devise wants to log us out after password changes - if Spree::Auth::Config[:signout_after_password_change] + if Spree::Auth::Config.signout_after_password_change redirect_url = spree.login_url else bypass_sign_in(@user) diff --git a/lib/generators/solidus/auth/install/templates/config/initializers/devise.rb.erb b/lib/generators/solidus/auth/install/templates/config/initializers/devise.rb.erb index 3e1a9b0d..f636e1f5 100644 --- a/lib/generators/solidus/auth/install/templates/config/initializers/devise.rb.erb +++ b/lib/generators/solidus/auth/install/templates/config/initializers/devise.rb.erb @@ -1,4 +1,4 @@ # frozen_string_literal: true Devise.secret_key = '<%= SecureRandom.hex(64) %>' -Devise.email_regexp = Spree::Config[:default_email_regexp] +Devise.email_regexp = Spree::Config.default_email_regexp diff --git a/lib/patches/frontend/controllers/solidus_auth_devise/checkout_controller_patch.rb b/lib/patches/frontend/controllers/solidus_auth_devise/checkout_controller_patch.rb index 965cd6a2..048434bc 100644 --- a/lib/patches/frontend/controllers/solidus_auth_devise/checkout_controller_patch.rb +++ b/lib/patches/frontend/controllers/solidus_auth_devise/checkout_controller_patch.rb @@ -50,7 +50,7 @@ def check_registration end def registration_required? - Spree::Auth::Config[:registration_step] && + Spree::Auth::Config.registration_step && !already_registered? end @@ -60,7 +60,7 @@ def already_registered? def guest_authenticated? current_order&.email.present? && - Spree::Config[:allow_guest_checkout] + Spree::Config.allow_guest_checkout end # Overrides the equivalent method defined in Spree::Core. This variation of the method will ensure that users diff --git a/lib/views/frontend/spree/checkout/registration.html.erb b/lib/views/frontend/spree/checkout/registration.html.erb index 15af8565..955fe27b 100644 --- a/lib/views/frontend/spree/checkout/registration.html.erb +++ b/lib/views/frontend/spree/checkout/registration.html.erb @@ -4,7 +4,7 @@