diff --git a/lib/clearance/back_door.rb b/lib/clearance/back_door.rb index f9e62c983..58fe82d65 100644 --- a/lib/clearance/back_door.rb +++ b/lib/clearance/back_door.rb @@ -54,7 +54,6 @@ def sign_in_through_the_back_door(env) if user_param.present? 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 diff --git a/spec/dummy/app/controllers/application_controller.rb b/spec/dummy/app/controllers/application_controller.rb index c7635bbb6..c88fb42a4 100644 --- a/spec/dummy/app/controllers/application_controller.rb +++ b/spec/dummy/app/controllers/application_controller.rb @@ -2,6 +2,6 @@ class ApplicationController < ActionController::Base include Clearance::Controller def show - render inline: "Hello user #<%= current_user.id %>", layout: false + render inline: "Hello user #<%= current_user.id %> #{params.to_json}", layout: false end end diff --git a/spec/requests/backdoor_spec.rb b/spec/requests/backdoor_spec.rb index 75887291e..bec2b5571 100644 --- a/spec/requests/backdoor_spec.rb +++ b/spec/requests/backdoor_spec.rb @@ -8,4 +8,12 @@ expect(cookies["remember_token"]).to eq user.remember_token end + + it "removes the `as` param but leaves other parameters unchanged" do + user = create(:user) + + get root_path(as: user.to_param, foo: 'bar') + + expect(response.body).to include('{"foo":"bar","controller":"application","action":"show"}') + end end