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:
commit
90d4d8a393
2 changed files with 5 additions and 2 deletions
|
@ -29,7 +29,7 @@ class Users::SessionsController < Sessions::SessionsController
|
||||||
if gestionnaire_signed_in?
|
if gestionnaire_signed_in?
|
||||||
if trusted_device? || !current_gestionnaire.feature_enabled?(:enable_email_login_token)
|
if trusted_device? || !current_gestionnaire.feature_enabled?(:enable_email_login_token)
|
||||||
set_flash_message :notice, :signed_in
|
set_flash_message :notice, :signed_in
|
||||||
redirect_to gestionnaire_procedures_path
|
redirect_to after_sign_in_path_for(:user)
|
||||||
else
|
else
|
||||||
gestionnaire = current_gestionnaire
|
gestionnaire = current_gestionnaire
|
||||||
login_token = gestionnaire.login_token!
|
login_token = gestionnaire.login_token!
|
||||||
|
|
|
@ -55,7 +55,10 @@ describe Users::SessionsController, type: :controller do
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'directly log the gestionnaire' do
|
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_user).to be(nil)
|
||||||
expect(subject.current_gestionnaire).to eq(gestionnaire)
|
expect(subject.current_gestionnaire).to eq(gestionnaire)
|
||||||
expect(subject.current_administrateur).to be(nil)
|
expect(subject.current_administrateur).to be(nil)
|
||||||
|
|
Loading…
Reference in a new issue