save path before redirect to link_sent_path

This commit is contained in:
simon lehericey 2019-02-06 20:51:04 +01:00
parent 7de3a18fd1
commit c16e30442a
2 changed files with 6 additions and 0 deletions

View file

@ -161,6 +161,10 @@ class ApplicationController < ActionController::Base
current_gestionnaire.feature_enabled?(:enable_email_login_token) &&
!trusted_device?
# return at this location
# after the device is trusted
store_location_for(:user, request.fullpath)
send_login_token_or_bufferize(current_gestionnaire)
redirect_to link_sent_path(email: current_gestionnaire.email)
end

View file

@ -159,6 +159,7 @@ describe ApplicationController, type: :controller do
allow(@controller).to receive(:gestionnaire_signed_in?).and_return(gestionnaire_signed_in)
allow(@controller).to receive(:sensitive_path).and_return(sensitive_path)
allow(@controller).to receive(:send_login_token_or_bufferize)
allow(@controller).to receive(:store_location_for)
end
subject { @controller.send(:redirect_if_untrusted) }
@ -191,6 +192,7 @@ describe ApplicationController, type: :controller do
it { expect(@controller).to have_received(:redirect_to) }
it { expect(@controller).to have_received(:send_login_token_or_bufferize) }
it { expect(@controller).to have_received(:store_location_for) }
end
end
end