Merge pull request #5713 from betagouv/feat/5701-fix

Feat/5701 fix - Ajoute les informations France Connect
This commit is contained in:
Kara Diaby 2020-11-05 19:51:53 +01:00 committed by GitHub
commit 7762d9fa28
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 46 additions and 1 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.3 KiB

View file

@ -59,6 +59,7 @@ class Dossier < ApplicationRecord
has_one :etablissement, dependent: :destroy
has_one :individual, validate: false, dependent: :destroy
has_one :attestation, dependent: :destroy
has_one :france_connect_information, through: :user
has_one_attached :justificatif_motivation

View file

@ -188,6 +188,9 @@ prawn_document(page_size: "A4") do |pdf|
add_title(pdf, "Identité du demandeur")
if @dossier.france_connect_information.present?
format_in_2_columns(pdf, 'Informations France Connect', "Le dossier a été déposé par le compte de #{@dossier.france_connect_information.given_name} #{@dossier.france_connect_information.family_name}, authentifié par France Connect le #{@dossier.france_connect_information.updated_at.strftime('%d/%m/%Y')}")
end
format_in_2_columns(pdf, "Email", @dossier.user.email)
add_identite_individual(pdf, @dossier) if @dossier.individual.present?
render_identite_etablissement(pdf, @dossier.etablissement) if @dossier.etablissement.present?

View file

@ -5,6 +5,8 @@
.tab-title Identité du demandeur
.card
- if dossier.france_connect_information.present?
= render partial: "shared/dossiers/france_connect_informations", locals: { user_information: dossier.france_connect_information }
= render partial: "shared/dossiers/user_infos", locals: { user: dossier.user }
- if dossier.etablissement.present?

View file

@ -21,7 +21,8 @@
Votre dossier est enregistré automatiquement après chaque modification. Vous pouvez à tout moment fermer la fenêtre et reprendre plus tard là où vous en étiez.
- else
Pour enregistrer votre dossier et le reprendre plus tard, cliquez sur le bouton « Enregistrer le brouillon » en bas à gauche du formulaire.
- if !apercu && dossier.france_connect_information.present?
= render partial: "shared/dossiers/france_connect_informations", locals: { user_information: dossier.france_connect_information }
- if notice_url(dossier.procedure).present?
= link_to notice_url(dossier.procedure), target: '_blank', rel: 'noopener', class: 'button notice', title: "Pour vous aider à remplir votre dossier, vous pouvez consulter le guide de cette démarche." do
%span.icon.info>

View file

@ -0,0 +1,4 @@
.card.featured
.flex.justify-center
= image_tag "logo-france-connect.png", alt: "France Connect logo", width: 200, class: "mb-2"
.card-title Le dossier a été déposé par le compte de #{user_information.given_name} #{user_information.family_name}, authentifié par France Connect le #{user_information.updated_at.strftime('%d/%m/%Y')}.

View file

@ -68,6 +68,10 @@ feature 'France Connect Particulier Connexion' do
scenario 'he is redirected to user dossiers page' do
expect(page).to have_content('Dossiers')
end
scenario 'the updated_at date is well updated' do
expect(france_connect_information.updated_at).not_to eq(france_connect_information.created_at)
end
end
end

View file

@ -18,4 +18,19 @@ describe 'instructeurs/dossiers/show.html.haml', type: :view do
expect(rendered).to have_text('Identité')
expect(rendered).to have_text('Demande')
end
context 'when the user is logged in with france connect' do
let(:france_connect_information) { build(:france_connect_information) }
let(:user) { build(:user, france_connect_information: france_connect_information) }
let(:procedure1) { create(:procedure, :with_type_de_champ, for_individual: true) }
let(:dossier) { create(:dossier, procedure: procedure1, user: user) }
before do
render
end
it 'fills the individual with the informations from France Connect' do
expect(rendered).to have_text("Le dossier a été déposé par le compte de #{france_connect_information.given_name} #{france_connect_information.family_name}, authentifié par France Connect le #{france_connect_information.updated_at.strftime('%d/%m/%Y')}")
end
end
end

View file

@ -33,4 +33,19 @@ describe 'users/dossiers/demande.html.haml', type: :view do
it { expect(rendered).not_to have_text('Déposé le') }
end
context 'when the user is logged in with france connect' do
let(:france_connect_information) { build(:france_connect_information) }
let(:user) { build(:user, france_connect_information: france_connect_information) }
let(:procedure1) { create(:procedure, :with_type_de_champ, for_individual: true) }
let(:dossier) { create(:dossier, procedure: procedure1, user: user) }
before do
render
end
it 'fills the individual with the informations from France Connect' do
expect(rendered).to have_text("Le dossier a été déposé par le compte de #{france_connect_information.given_name} #{france_connect_information.family_name}, authentifié par France Connect le #{france_connect_information.updated_at.strftime('%d/%m/%Y')}")
end
end
end