Merge pull request 'Upgrade Devise, remove custom Turbo integration' (#102) from chore/87-upgrade_devise into master
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
Reviewed-on: #102
This commit is contained in:
commit
cb80465297
2
Gemfile
2
Gemfile
@ -32,7 +32,7 @@ gem 'lockbox'
|
|||||||
|
|
||||||
# Authentication
|
# Authentication
|
||||||
gem 'warden'
|
gem 'warden'
|
||||||
gem 'devise'
|
gem 'devise', '~> 4.9.0'
|
||||||
gem 'devise_ldap_authenticatable'
|
gem 'devise_ldap_authenticatable'
|
||||||
gem 'net-ldap'
|
gem 'net-ldap'
|
||||||
|
|
||||||
|
10
Gemfile.lock
10
Gemfile.lock
@ -95,7 +95,7 @@ GEM
|
|||||||
activerecord (>= 5.a)
|
activerecord (>= 5.a)
|
||||||
database_cleaner-core (~> 2.0.0)
|
database_cleaner-core (~> 2.0.0)
|
||||||
database_cleaner-core (2.0.1)
|
database_cleaner-core (2.0.1)
|
||||||
devise (4.8.1)
|
devise (4.9.0)
|
||||||
bcrypt (~> 3.0)
|
bcrypt (~> 3.0)
|
||||||
orm_adapter (~> 0.1)
|
orm_adapter (~> 0.1)
|
||||||
railties (>= 4.1.0)
|
railties (>= 4.1.0)
|
||||||
@ -226,9 +226,9 @@ GEM
|
|||||||
redis-client (0.11.2)
|
redis-client (0.11.2)
|
||||||
connection_pool
|
connection_pool
|
||||||
regexp_parser (2.6.1)
|
regexp_parser (2.6.1)
|
||||||
responders (3.0.1)
|
responders (3.1.0)
|
||||||
actionpack (>= 5.0)
|
actionpack (>= 5.2)
|
||||||
railties (>= 5.0)
|
railties (>= 5.2)
|
||||||
rexml (3.2.5)
|
rexml (3.2.5)
|
||||||
rqrcode (2.1.2)
|
rqrcode (2.1.2)
|
||||||
chunky_png (~> 1.0)
|
chunky_png (~> 1.0)
|
||||||
@ -315,7 +315,7 @@ DEPENDENCIES
|
|||||||
capybara
|
capybara
|
||||||
cssbundling-rails
|
cssbundling-rails
|
||||||
database_cleaner
|
database_cleaner
|
||||||
devise
|
devise (~> 4.9.0)
|
||||||
devise_ldap_authenticatable
|
devise_ldap_authenticatable
|
||||||
dotenv-rails
|
dotenv-rails
|
||||||
factory_bot_rails
|
factory_bot_rails
|
||||||
|
@ -3,30 +3,12 @@ require 'digest'
|
|||||||
require 'securerandom'
|
require 'securerandom'
|
||||||
# frozen_string_literal: true
|
# 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.
|
# Many of these configuration options can be set straight in your model.
|
||||||
Devise.setup do |config|
|
Devise.setup do |config|
|
||||||
|
# Hotwire/Turbo
|
||||||
|
config.responder.error_status = :unprocessable_entity
|
||||||
|
config.responder.redirect_status = :see_other
|
||||||
|
|
||||||
# ==> LDAP Configuration
|
# ==> LDAP Configuration
|
||||||
config.ldap_logger = true
|
config.ldap_logger = true
|
||||||
config.ldap_create_user = true
|
config.ldap_create_user = true
|
||||||
@ -59,7 +41,6 @@ Devise.setup do |config|
|
|||||||
# ==> Controller configuration
|
# ==> Controller configuration
|
||||||
# Configure the parent class to the devise controllers.
|
# Configure the parent class to the devise controllers.
|
||||||
# config.parent_controller = 'DeviseController'
|
# config.parent_controller = 'DeviseController'
|
||||||
config.parent_controller = 'TurboController'
|
|
||||||
|
|
||||||
# ==> Mailer Configuration
|
# ==> Mailer Configuration
|
||||||
# Configure the e-mail address which will be shown in Devise::Mailer,
|
# 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
|
# 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.
|
# change the failure app, you can configure them inside the config.warden block.
|
||||||
#
|
#
|
||||||
config.warden do |manager|
|
# config.warden do |manager|
|
||||||
manager.failure_app = TurboFailureApp
|
|
||||||
# manager.intercept_401 = false
|
# manager.intercept_401 = false
|
||||||
# manager.default_strategies(scope: :user).unshift :some_external_strategy
|
# manager.default_strategies(scope: :user).unshift :some_external_strategy
|
||||||
end
|
# end
|
||||||
|
|
||||||
# ==> Mountable engine configurations
|
# ==> Mountable engine configurations
|
||||||
# When using Devise inside an engine, let's call it `MyEngine`, and this engine
|
# 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:
|
# so you need to do it manually. For the users scope, it would be:
|
||||||
# config.omniauth_path_prefix = '/my_engine/users/auth'
|
# 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
|
# ==> Configuration for :registerable
|
||||||
|
|
||||||
# When set to false, does not sign a user in automatically after their password is
|
# When set to false, does not sign a user in automatically after their password is
|
||||||
|
Loading…
x
Reference in New Issue
Block a user