diff --git a/Gemfile b/Gemfile index 97c230e..a1918c1 100644 --- a/Gemfile +++ b/Gemfile @@ -32,7 +32,7 @@ gem 'lockbox' # Authentication gem 'warden' -gem 'devise' +gem 'devise', '~> 4.9.0' gem 'devise_ldap_authenticatable' gem 'net-ldap' diff --git a/Gemfile.lock b/Gemfile.lock index 3e28d0f..e788bef 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -95,7 +95,7 @@ GEM activerecord (>= 5.a) database_cleaner-core (~> 2.0.0) database_cleaner-core (2.0.1) - devise (4.8.1) + devise (4.9.0) bcrypt (~> 3.0) orm_adapter (~> 0.1) railties (>= 4.1.0) @@ -226,9 +226,9 @@ GEM redis-client (0.11.2) connection_pool regexp_parser (2.6.1) - responders (3.0.1) - actionpack (>= 5.0) - railties (>= 5.0) + responders (3.1.0) + actionpack (>= 5.2) + railties (>= 5.2) rexml (3.2.5) rqrcode (2.1.2) chunky_png (~> 1.0) @@ -315,7 +315,7 @@ DEPENDENCIES capybara cssbundling-rails database_cleaner - devise + devise (~> 4.9.0) devise_ldap_authenticatable dotenv-rails factory_bot_rails diff --git a/config/initializers/devise.rb b/config/initializers/devise.rb index 91efcee..3b0ffeb 100644 --- a/config/initializers/devise.rb +++ b/config/initializers/devise.rb @@ -3,30 +3,12 @@ require 'digest' require 'securerandom' # frozen_string_literal: true -# Create custom failure for turbo -class TurboFailureApp < Devise::FailureApp - def respond - if request_format == :turbo_stream - redirect - else - super - end - end - - def skip_format? - %w(html turbo_stream */*).include? request_format.to_s - end -end - -# 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| + # Hotwire/Turbo + config.responder.error_status = :unprocessable_entity + config.responder.redirect_status = :see_other + # ==> LDAP Configuration config.ldap_logger = true config.ldap_create_user = true @@ -59,7 +41,6 @@ Devise.setup do |config| # ==> Controller configuration # Configure the parent class to the devise controllers. # config.parent_controller = 'DeviseController' - config.parent_controller = 'TurboController' # ==> Mailer Configuration # Configure the e-mail address which will be shown in Devise::Mailer, @@ -319,11 +300,10 @@ Devise.setup do |config| # If you want to use other strategies, that are not supported by Devise, or # change the failure app, you can configure them inside the config.warden block. # - config.warden do |manager| - manager.failure_app = TurboFailureApp + # config.warden do |manager| # manager.intercept_401 = false # manager.default_strategies(scope: :user).unshift :some_external_strategy - end + # end # ==> Mountable engine configurations # When using Devise inside an engine, let's call it `MyEngine`, and this engine @@ -339,13 +319,6 @@ 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 - # ==> Configuration for :registerable # When set to false, does not sign a user in automatically after their password is