diff --git a/Gemfile b/Gemfile index fac0d4a..1b474e8 100644 --- a/Gemfile +++ b/Gemfile @@ -8,11 +8,15 @@ gem "rails", "~> #{rails_version}.0" gem "listen", "~> 3.8" gem "puma", "~> 6.0" +gem "sprockets-rails", "< 3.5.0" + # Specify your gem's dependencies in alchemy-solidus.gemspec gemspec group :test do - gem "sqlite3" if ENV["DB"].nil? || ENV["DB"] == "sqlite" + if ENV["DB"].nil? || ENV["DB"] == "sqlite" + gem "sqlite3", "~> 1.4" + end gem "mysql2" if ENV["DB"] == "mysql" gem "pg", "~> 1.0" if ENV["DB"] == "postgresql" end diff --git a/alchemy-devise.gemspec b/alchemy-devise.gemspec index 5fe6692..e388ed7 100644 --- a/alchemy-devise.gemspec +++ b/alchemy-devise.gemspec @@ -15,8 +15,8 @@ Gem::Specification.new do |s| s.files = Dir["{app,config,db,lib}/**/*", "LICENSE", "CHANGELOG.md", "README.md"] - s.add_dependency "alchemy_cms", [">= 7.0.0", "< 8"] - s.add_dependency "devise", [">= 4.7.1", "< 5"] + s.add_dependency "alchemy_cms", ["~> 7.0"] + s.add_dependency "devise", ["~> 4.9"] s.add_development_dependency "capybara" s.add_development_dependency "factory_bot_rails" diff --git a/lib/generators/alchemy/devise/install/templates/devise.rb.tt b/lib/generators/alchemy/devise/install/templates/devise.rb.tt index 15c1660..1129c17 100644 --- a/lib/generators/alchemy/devise/install/templates/devise.rb.tt +++ b/lib/generators/alchemy/devise/install/templates/devise.rb.tt @@ -1,5 +1,11 @@ # frozen_string_literal: true +# Assuming you have not yet modified this file, each configuration option below +# is set to its default value. Note that some are commented out while others +# are not: uncommented lines are intended to protect your configuration from +# breaking changes in upgrades (i.e., in the event that future versions of +# Devise change the default values for those options). +# # Use this hook to configure devise mailer, warden hooks and so forth. # Many of these configuration options can be set straight in your model. Devise.setup do |config| @@ -68,7 +74,10 @@ Devise.setup do |config| # Tell if authentication through HTTP Auth is enabled. False by default. # It can be set to an array that will enable http authentication only for the # given strategies, for example, `config.http_authenticatable = [:database]` will - # enable it only for database authentication. The supported strategies are: + # enable it only for database authentication. + # For API-only applications to support authentication "out-of-the-box", you will likely want to + # enable this with :database unless you are using a custom strategy. + # The supported strategies are: # :database = Support basic authentication with authentication key + password config.http_authenticatable = true @@ -103,15 +112,18 @@ Devise.setup do |config| # config.reload_routes = true # ==> Configuration for :database_authenticatable - # For bcrypt, this is the cost for hashing the password and defaults to 11. If + # For bcrypt, this is the cost for hashing the password and defaults to 12. If # using other algorithms, it sets how many times you want the password to be hashed. + # The number of stretches used for generating the hashed password are stored + # with the hashed password. This allows you to change the stretches without + # invalidating existing passwords. # # Limiting the stretches to just one in testing will increase the performance of # your test suite dramatically. However, it is STRONGLY RECOMMENDED to not use # a value less than 10 in other environments. Note that, for bcrypt (the default # algorithm), the cost increases exponentially with the number of stretches (e.g. # a value of 20 is already extremely slow: approx. 60 seconds for 1 calculation). - config.stretches = Rails.env.test? ? 1 : 11 + config.stretches = Rails.env.test? ? 1 : 12 # Set up a pepper to generate the hashed password. # config.pepper = '<%= SecureRandom.hex(64) %>' @@ -244,14 +256,14 @@ Devise.setup do |config| # ==> Navigation configuration # Lists the formats that should be treated as navigational. Formats like - # :html, should redirect to the sign in page when the user does not have + # :html should redirect to the sign in page when the user does not have # access, but formats like :xml or :json, should return 401. # # If you have any extra navigational formats, like :iphone or :mobile, you # should add them to the navigational formats lists. # # The "*/*" below is required to match Internet Explorer requests. - # config.navigational_formats = ['*/*', :html] + # config.navigational_formats = ['*/*', :html, :turbo_stream] # The default HTTP method used to sign out a resource. Default is :delete. config.sign_out_via = :delete @@ -284,12 +296,14 @@ Devise.setup do |config| # so you need to do it manually. For the users scope, it would be: # config.omniauth_path_prefix = '/my_engine/users/auth' - # ==> Turbolinks configuration - # If your app is using Turbolinks, Turbolinks::Controller needs to be included to make redirection work correctly: - # - # ActiveSupport.on_load(:devise_failure_app) do - # include Turbolinks::Controller - # end + # ==> Hotwire/Turbo configuration + # When using Devise with Hotwire/Turbo, the http status for error responses + # and some redirects must match the following. The default in Devise for existing + # apps is `200 OK` and `302 Found` respectively, but new apps are generated with + # these new defaults that match Hotwire/Turbo behavior. + # Note: These might become the new default in future versions of Devise. + config.responder.error_status = :unprocessable_entity + config.responder.redirect_status = :see_other # ==> Configuration for :registerable