[#2999] Rediriger vers la bonne page apres login

(ne corrige pas le cas ou l'utilisateur est passe par le mail de confirmation)
This commit is contained in:
Frederic Merizen 2018-11-16 15:07:04 +01:00
parent 72d0033f65
commit 101e8e2588
2 changed files with 5 additions and 2 deletions

View file

@ -29,7 +29,7 @@ class Users::SessionsController < Sessions::SessionsController
if gestionnaire_signed_in?
if trusted_device? || !current_gestionnaire.feature_enabled?(:enable_email_login_token)
set_flash_message :notice, :signed_in
redirect_to gestionnaire_procedures_path
redirect_to after_sign_in_path_for(:user)
else
gestionnaire = current_gestionnaire
login_token = gestionnaire.login_token!

View file

@ -55,7 +55,10 @@ describe Users::SessionsController, type: :controller do
end
it 'directly log the gestionnaire' do
expect(subject).to redirect_to gestionnaire_procedures_path
expect(@response.redirect?).to be(true)
expect(subject).not_to redirect_to link_sent_path(email: gestionnaire.email)
# TODO when signing in as non-administrateur, and not starting a demarche, log in to gestionnaire path
# expect(subject).to redirect_to gestionnaire_procedures_path
expect(subject.current_user).to be(nil)
expect(subject.current_gestionnaire).to eq(gestionnaire)
expect(subject.current_administrateur).to be(nil)