Merge pull request #3000 from betagouv/frederic/fix_2999-bad_redirect_after_login

[#2999] Rediriger vers la bonne page apres login
This commit is contained in:
Frederic Merizen 2018-11-16 15:54:01 +01:00 committed by GitHub
commit 90d4d8a393
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
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)