Skip to content

Commit

Permalink
Fix Rails 7.1 compatibility issues
Browse files Browse the repository at this point in the history
  • Loading branch information
elektronaut committed Feb 1, 2024
1 parent 3066a0b commit 000fe3d
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 4 deletions.
2 changes: 1 addition & 1 deletion app/controllers/admin/account_recoveries_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ def fail_recovery(message)

def find_by_token
@token = params[:token]
@user = User.find(message_verifier.verify(@token)[:id])
@user = User.find(message_verifier.verify(@token).symbolize_keys[:id])
return if @user

fail_recovery(t("pages_core.account_recovery.invalid_request"))
Expand Down
2 changes: 1 addition & 1 deletion app/models/otp_secret.rb
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ def valid_otp?(otp)
end

def verify_secret(signed)
payload = message_verifier.verify(signed)
payload = message_verifier.verify(signed).symbolize_keys
raise "Wrong user" unless payload[:user_id] == user.id

payload[:secret]
Expand Down
7 changes: 6 additions & 1 deletion spec/internal/config/application.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,12 @@
module Internal
class Application < Rails::Application
# Initialize configuration defaults for originally generated Rails version.
config.load_defaults 7.0
config.load_defaults 7.1

# Please, add to the `ignore` list any other `lib` subdirectories that do
# not contain `.rb` files, or that should not be reloaded or eager loaded.
# Common ones are `templates`, `generators`, or `middleware`, for example.
config.autoload_lib(ignore: %w[assets tasks])

# Settings in config/environments/* take precedence over those
# specified here. Application configuration should go into files
Expand Down
2 changes: 1 addition & 1 deletion spec/internal/config/environments/test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
config.action_controller.perform_caching = false

# Raise exceptions instead of rendering exception templates.
config.action_dispatch.show_exceptions = false
config.action_dispatch.show_exceptions = :none

# Disable request forgery protection in test environment.
config.action_controller.allow_forgery_protection = false
Expand Down

0 comments on commit 000fe3d

Please sign in to comment.