parent
28dcbcb85b
commit
22f2ca105e
5 changed files with 32 additions and 0 deletions
|
@ -34,6 +34,11 @@ module Users
|
|||
redirect_to new_user_registration_path
|
||||
end
|
||||
|
||||
def france_connect
|
||||
store_user_location!
|
||||
redirect_to france_connect_particulier_path
|
||||
end
|
||||
|
||||
def procedure_for_help
|
||||
Procedure.publiees.find_by(path: params[:path]) || Procedure.brouillons.find_by(path: params[:path])
|
||||
end
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
%span.optional-on-small-screens
|
||||
demarches-simplifiees.fr
|
||||
= link_to 'J’ai déjà un compte', commencer_sign_in_path(path: @procedure.path), class: ['button large expand']
|
||||
= render partial: 'shared/france_connect_login', locals: { url: commencer_france_connect_path(path: @procedure.path) }
|
||||
|
||||
- else
|
||||
- dossiers = current_user.dossiers.where(procedure: @procedure)
|
||||
|
|
|
@ -270,6 +270,7 @@ Rails.application.routes.draw do
|
|||
get '/:path', action: 'commencer'
|
||||
get '/:path/sign_in', action: 'sign_in', as: :sign_in
|
||||
get '/:path/sign_up', action: 'sign_up', as: :sign_up
|
||||
get '/:path/france_connect', action: 'france_connect', as: :france_connect
|
||||
end
|
||||
|
||||
resources :dossiers, only: [:index, :show, :new] do
|
||||
|
|
|
@ -112,4 +112,28 @@ describe Users::CommencerController, type: :controller do
|
|||
it { expect(subject).to redirect_to(new_user_registration_path) }
|
||||
end
|
||||
end
|
||||
|
||||
describe '#france_connect' do
|
||||
context 'for a published procedure' do
|
||||
subject { get :france_connect, params: { path: published_procedure.path } }
|
||||
|
||||
it 'set the path to return after sign-up to the procedure start page' do
|
||||
subject
|
||||
expect(controller.stored_location_for(:user)).to eq(commencer_path(path: published_procedure.path))
|
||||
end
|
||||
|
||||
it { expect(subject).to redirect_to(france_connect_particulier_path) }
|
||||
end
|
||||
|
||||
context 'for a draft procedure' do
|
||||
subject { get :france_connect, params: { path: draft_procedure.path } }
|
||||
|
||||
it 'set the path to return after sign-up to the draft procedure start page' do
|
||||
subject
|
||||
expect(controller.stored_location_for(:user)).to eq(commencer_test_path(path: draft_procedure.path))
|
||||
end
|
||||
|
||||
it { expect(subject).to redirect_to(france_connect_particulier_path) }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -21,6 +21,7 @@ RSpec.describe 'commencer/show.html.haml', type: :view do
|
|||
subject
|
||||
expect(rendered).to have_link('Créer un compte')
|
||||
expect(rendered).to have_link('J’ai déjà un compte')
|
||||
expect(rendered).to have_link('S’identifier avec FranceConnect')
|
||||
end
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in a new issue