Merge pull request 'Upgrade Devise to 5.0, remove obsolete workarounds' (#244) from chore/upgrade_devise into master
CI / Test (push) Successful in 31s

Reviewed-on: #244
This commit was merged in pull request #244.
This commit is contained in:
2026-08-10 22:40:47 +00:00
7 changed files with 47 additions and 64 deletions
+1 -1
View File
@@ -27,7 +27,7 @@ gem 'dotenv-rails'
# Authentication
gem 'warden'
gem 'devise', '~> 4.9.0'
gem 'devise', '~> 5.0'
gem 'devise_ldap_authenticatable'
gem 'net-ldap'
+38 -33
View File
@@ -96,12 +96,12 @@ GEM
aws-sigv4 (1.11.0)
aws-eventstream (~> 1, >= 1.0.2)
backport (1.2.0)
base64 (0.2.0)
bcrypt (3.1.20)
base64 (0.3.0)
bcrypt (3.1.22)
bech32 (1.5.0)
thor (>= 1.1.0)
benchmark (0.4.0)
bigdecimal (3.1.9)
benchmark (0.5.0)
bigdecimal (4.1.2)
bindex (0.8.1)
bip-schnorr (0.7.0)
ecdsa_ext (~> 0.5.0)
@@ -119,11 +119,11 @@ GEM
logger (~> 1.5)
chunky_png (1.4.0)
concurrent-ruby (1.3.4)
connection_pool (2.5.2)
connection_pool (3.0.2)
crack (1.0.0)
bigdecimal
rexml
crass (1.0.6)
crass (1.0.7)
cssbundling-rails (1.4.3)
railties (>= 6.0.0)
database_cleaner (2.1.0)
@@ -132,11 +132,11 @@ GEM
activerecord (>= 5.a)
database_cleaner-core (~> 2.0.0)
database_cleaner-core (2.0.1)
date (3.4.1)
devise (4.9.4)
date (3.5.1)
devise (5.0.4)
bcrypt (~> 3.0)
orm_adapter (~> 0.1)
railties (>= 4.1.0)
railties (>= 7.0)
responders
warden (~> 1.2.3)
devise_ldap_authenticatable (0.8.7)
@@ -154,10 +154,11 @@ GEM
railties (>= 6.1)
down (5.4.2)
addressable (~> 2.8)
drb (2.2.1)
drb (2.2.3)
ecdsa (1.2.0)
ecdsa_ext (0.5.1)
ecdsa (~> 1.2.0)
erb (6.0.7)
erubi (1.13.1)
et-orbi (1.2.11)
tzinfo
@@ -204,7 +205,7 @@ GEM
gpgme (2.0.24)
mini_portile2 (~> 2.7)
hashdiff (1.1.2)
i18n (1.14.7)
i18n (1.15.2)
concurrent-ruby (~> 1.0)
image_processing (1.12.2)
mini_magick (>= 4.9.5, < 5)
@@ -213,9 +214,10 @@ GEM
actionpack (>= 6.0.0)
activesupport (>= 6.0.0)
railties (>= 6.0.0)
io-console (0.8.0)
irb (1.15.2)
io-console (0.9.2)
irb (1.18.0)
pp (>= 0.6.0)
prism (>= 1.3.0)
rdoc (>= 4.0.0)
reline (>= 0.4.2)
jaro_winkler (1.6.0)
@@ -247,7 +249,7 @@ GEM
lnurl (1.1.1)
bech32 (~> 1.1)
logger (1.7.0)
loofah (2.24.0)
loofah (2.25.2)
crass (~> 1.0.2)
nokogiri (>= 1.12.0)
mail (2.8.1)
@@ -264,8 +266,8 @@ GEM
method_source (1.1.0)
mini_magick (4.13.2)
mini_mime (1.1.5)
mini_portile2 (2.8.8)
minitest (5.25.5)
mini_portile2 (2.8.9)
minitest (5.27.0)
mission_control-jobs (1.0.2)
actioncable (>= 7.1)
actionpack (>= 7.1)
@@ -313,7 +315,7 @@ GEM
ast (~> 2.4.1)
racc
pg (1.5.9)
pp (0.6.2)
pp (0.6.4)
prettyprint
prettyprint (0.2.0)
prism (1.4.0)
@@ -322,7 +324,7 @@ GEM
activesupport (>= 7.0.0)
rack
railties (>= 7.0.0)
psych (5.2.3)
psych (5.4.0)
date
stringio
public_suffix (6.0.1)
@@ -330,7 +332,7 @@ GEM
nio4r (~> 2.0)
raabro (1.4.0)
racc (1.8.1)
rack (2.2.13)
rack (2.2.23)
rack-protection (3.2.0)
base64 (>= 0.1.0)
rack (~> 2.2, >= 2.2.4)
@@ -359,12 +361,12 @@ GEM
actionpack (>= 5.0.1.rc1)
actionview (>= 5.0.1.rc1)
activesupport (>= 5.0.1.rc1)
rails-dom-testing (2.2.0)
rails-dom-testing (2.3.0)
activesupport (>= 5.0.0)
minitest
nokogiri (>= 1.6)
rails-html-sanitizer (1.6.2)
loofah (~> 2.21)
rails-html-sanitizer (1.7.1)
loofah (~> 2.25, >= 2.25.2)
nokogiri (>= 1.15.7, != 1.16.7, != 1.16.6, != 1.16.5, != 1.16.4, != 1.16.3, != 1.16.2, != 1.16.1, != 1.16.0.rc1, != 1.16.0)
rails-settings-cached (2.8.3)
activerecord (>= 5.0.0)
@@ -378,24 +380,26 @@ GEM
thor (~> 1.0, >= 1.2.2)
zeitwerk (~> 2.6)
rainbow (3.1.1)
rake (13.2.1)
rake (13.4.2)
rb-fsevent (0.11.2)
rb-inotify (0.11.1)
ffi (~> 1.0)
rbs (3.9.2)
logger
rdoc (6.13.1)
rdoc (7.2.0)
erb
psych (>= 4.0.0)
tsort
redis (5.4.0)
redis-client (>= 0.22.0)
redis-client (0.24.0)
connection_pool
regexp_parser (2.10.0)
reline (0.6.1)
reline (0.7.0)
io-console (~> 0.5)
responders (3.1.1)
actionpack (>= 5.2)
railties (>= 5.2)
responders (3.2.0)
actionpack (>= 7.0)
railties (>= 7.0)
reverse_markdown (3.0.0)
nokogiri
rexml (3.4.1)
@@ -480,10 +484,11 @@ GEM
sqlite3 (2.6.0-x86_64-linux-gnu)
stimulus-rails (1.3.4)
railties (>= 6.0.0)
stringio (3.1.7)
stringio (3.2.0)
thor (1.3.2)
tilt (2.6.0)
timeout (0.4.3)
tsort (0.2.0)
turbo-rails (2.0.13)
actionpack (>= 7.1.0)
railties (>= 7.1.0)
@@ -492,7 +497,7 @@ GEM
unicode-display_width (3.1.4)
unicode-emoji (~> 4.0, >= 4.0.4)
unicode-emoji (4.0.4)
uri (1.0.3)
uri (1.1.1)
useragent (0.16.11)
view_component (3.22.0)
activesupport (>= 5.2.0, < 8.1)
@@ -509,7 +514,7 @@ GEM
addressable (>= 2.8.0)
crack (>= 0.3.2)
hashdiff (>= 0.4.0, < 2.0.0)
webrick (1.9.1)
webrick (1.9.2)
websocket-driver (0.7.7)
base64
websocket-extensions (>= 0.1.0)
@@ -520,7 +525,7 @@ GEM
yard-solargraph (0.1.0)
yard (~> 0.9)
zbase32 (0.1.1)
zeitwerk (2.7.2)
zeitwerk (2.8.3)
PLATFORMS
arm64-darwin-22
@@ -534,7 +539,7 @@ DEPENDENCIES
capybara
cssbundling-rails
database_cleaner
devise (~> 4.9.0)
devise (~> 5.0)
devise_ldap_authenticatable
discourse_api
dotenv-rails
-18
View File
@@ -1,18 +0,0 @@
class TurboController < ApplicationController
class Responder < ActionController::Responder
def to_turbo_stream
controller.render(options.merge(formats: :html))
rescue ActionView::MissingTemplate => error
if get?
raise error
elsif has_errors? && default_action
render rendering_options.merge(formats: :html, status: :unprocessable_entity)
else
redirect_to navigation_location
end
end
end
self.responder = Responder
respond_to :html, :turbo_stream
end
+1 -1
View File
@@ -6,7 +6,7 @@ class Users::DeviseController < ApplicationController
if get?
raise error
elsif has_errors? && default_action
render rendering_options.merge(formats: :html, status: :unprocessable_entity)
render error_rendering_options.merge(formats: :html, status: :unprocessable_entity)
else
redirect_to navigation_location
end
@@ -1,5 +1,5 @@
<% if resource.errors.any? %>
<div id="error_explanation">
<div id="error_explanation" class="mb-6">
<ul>
<% resource.errors.full_messages.each do |message| %>
<li class="text-red-600"><%= message %></li>
+6 -5
View File
@@ -6,6 +6,7 @@ require 'securerandom'
# Many of these configuration options can be set straight in your model.
Devise.setup do |config|
# Hotwire/Turbo
config.parent_controller = 'Users::DeviseController'
config.responder.error_status = :unprocessable_entity
config.responder.redirect_status = :see_other
@@ -325,9 +326,9 @@ Devise.setup do |config|
# config.sign_in_after_change_password = true
end
# https://github.com/heartcombo/devise/issues/5644
class Devise::SecretKeyFinder
def find
@application.secret_key_base
end
# Turbo-aware responder for Devise controllers
ActiveSupport.on_load(:devise_controller) do
self.responder = Users::DeviseController::Responder
Users::DeviseController::Responder.error_status = :unprocessable_entity
Users::DeviseController::Responder.redirect_status = :see_other
end
-5
View File
@@ -14,11 +14,6 @@
#
# See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
RSpec.configure do |config|
# TODO Remove when Devise fixes https://github.com/heartcombo/devise/issues/5705
config.before(:each, type: :controller) do
Rails.application.reload_routes_unless_loaded
end
# rspec-expectations config goes here. You can use an alternate
# assertion/expectation library such as wrong or the stdlib/minitest
# assertions if you prefer.