Skip to content

Commit

Permalink
chore: Fix rack deprecation warning in BackDoor middleware
Browse files Browse the repository at this point in the history
  • Loading branch information
hasghari committed Aug 17, 2024
1 parent eed7edf commit 295b7eb
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions lib/clearance/back_door.rb
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,13 @@ def call(env)

# @api private
def sign_in_through_the_back_door(env)
params = Rack::Utils.parse_query(env["QUERY_STRING"])
params = Rack::Utils.parse_query(env[Rack::QUERY_STRING])
user_param = params.delete("as")

if user_param.present?
env["QUERY_STRING"] = Rack::Utils.build_query(params)
query_string = Rack::Utils.build_query(params)
env[Rack::QUERY_STRING] = query_string
env[Rack::RACK_REQUEST_QUERY_STRING] = query_string
user = find_user(user_param)
env[:clearance].sign_in(user)
end
Expand Down

0 comments on commit 295b7eb

Please sign in to comment.