From 101e8e2588931c31c66bd0f5cc68cde3c1abd4bf Mon Sep 17 00:00:00 2001 From: Frederic Merizen Date: Fri, 16 Nov 2018 15:07:04 +0100 Subject: [PATCH] [#2999] Rediriger vers la bonne page apres login (ne corrige pas le cas ou l'utilisateur est passe par le mail de confirmation) --- app/controllers/users/sessions_controller.rb | 2 +- spec/controllers/users/sessions_controller_spec.rb | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/app/controllers/users/sessions_controller.rb b/app/controllers/users/sessions_controller.rb index 610ce28b7..f8ca9fe9f 100644 --- a/app/controllers/users/sessions_controller.rb +++ b/app/controllers/users/sessions_controller.rb @@ -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! diff --git a/spec/controllers/users/sessions_controller_spec.rb b/spec/controllers/users/sessions_controller_spec.rb index 3fcc5e9de..8d55ac53f 100644 --- a/spec/controllers/users/sessions_controller_spec.rb +++ b/spec/controllers/users/sessions_controller_spec.rb @@ -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)