Skip to content

Commit

Permalink
fix unsafe redirect error part 2
Browse files Browse the repository at this point in the history
  • Loading branch information
wendelfabianchinsamy committed Jun 12, 2024
1 parent 1bf6ee3 commit 7f2b623
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 7 deletions.
7 changes: 0 additions & 7 deletions app/controllers/users/sessions_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -54,12 +54,5 @@ def empty_cookie
secure: !Rails.env.development? && !Rails.env.test?,
domain: domain }
end

private
def redirect_options
{
allow_other_host: true
}
end
end
end
14 changes: 14 additions & 0 deletions config/initializers/devise_allow_other_host.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# frozen_string_literal: true

module Devise
module Controllers
module Helpers
def redirect_to(options = {}, response_options = {})
if options.is_a?(String) && options.match?(/\Ahttps?:\/\//)
response_options[:allow_other_host] = true
end
super(options, response_options)
end
end
end
end

0 comments on commit 7f2b623

Please sign in to comment.