[#10799] Modifications after Marlene's comments
This commit is contained in:
parent
687617cb08
commit
6b326b634e
13 changed files with 26 additions and 23 deletions
|
@ -1,3 +1,3 @@
|
||||||
---
|
---
|
||||||
fr:
|
fr:
|
||||||
title: Jeton Entreprise
|
title: Jeton API Entreprise
|
||||||
|
|
|
@ -10,5 +10,5 @@
|
||||||
%p.fr-badge.fr-badge--info À configurer
|
%p.fr-badge.fr-badge--info À configurer
|
||||||
%div
|
%div
|
||||||
%h3.fr-h6.fr-mt-10v= t('.title')
|
%h3.fr-h6.fr-mt-10v= t('.title')
|
||||||
%p.fr-tile-subtitle Configurer le jeton API entreprise
|
%p.fr-tile-subtitle Configurer le jeton API Entreprise
|
||||||
%p.fr-btn.fr-btn--tertiary= t('views.shared.actions.edit')
|
%p.fr-btn.fr-btn--tertiary= t('views.shared.actions.edit')
|
||||||
|
|
|
@ -47,8 +47,6 @@ class Procedure::ErrorsSummary < ApplicationComponent
|
||||||
when :initiated_mail, :received_mail, :closed_mail, :refused_mail, :without_continuation_mail, :re_instructed_mail
|
when :initiated_mail, :received_mail, :closed_mail, :refused_mail, :without_continuation_mail, :re_instructed_mail
|
||||||
klass = "Mails::#{error.attribute.to_s.classify}".constantize
|
klass = "Mails::#{error.attribute.to_s.classify}".constantize
|
||||||
edit_admin_procedure_mail_template_path(@procedure, klass.const_get(:SLUG))
|
edit_admin_procedure_mail_template_path(@procedure, klass.const_get(:SLUG))
|
||||||
when :api_entreprise_token
|
|
||||||
jeton_admin_procedure_path(@procedure)
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -7,7 +7,6 @@ module APIEntrepriseTokenConcern
|
||||||
|
|
||||||
included do
|
included do
|
||||||
validates :api_entreprise_token, jwt_token: true, allow_blank: true
|
validates :api_entreprise_token, jwt_token: true, allow_blank: true
|
||||||
validate :api_entreprise_token_expiration_valid?, on: [:publication]
|
|
||||||
|
|
||||||
before_save :set_api_entreprise_token_expires_at, if: :will_save_change_to_api_entreprise_token?
|
before_save :set_api_entreprise_token_expires_at, if: :will_save_change_to_api_entreprise_token?
|
||||||
|
|
||||||
|
@ -19,12 +18,6 @@ module APIEntrepriseTokenConcern
|
||||||
self[:api_entreprise_token].presence || Rails.application.secrets.api_entreprise[:key]
|
self[:api_entreprise_token].presence || Rails.application.secrets.api_entreprise[:key]
|
||||||
end
|
end
|
||||||
|
|
||||||
def api_entreprise_token_expiration_valid?
|
|
||||||
if api_entreprise_token_expired_or_expires_soon?
|
|
||||||
errors.add(:api_entreprise_token, "expiré ou expirant bientôt")
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
def api_entreprise_token_expired?
|
def api_entreprise_token_expired?
|
||||||
APIEntrepriseToken.new(api_entreprise_token).expired?
|
APIEntrepriseToken.new(api_entreprise_token).expired?
|
||||||
end
|
end
|
||||||
|
|
|
@ -30,7 +30,7 @@
|
||||||
.flex.fr-mt-1w
|
.flex.fr-mt-1w
|
||||||
|
|
||||||
- if @procedure.api_entreprise_token_expired_or_expires_soon?
|
- if @procedure.api_entreprise_token_expired_or_expires_soon?
|
||||||
%span.fr-badge.fr-badge--warning.fr-mr-1w
|
%span.fr-badge.fr-badge--error.fr-mr-1w
|
||||||
= t('to_modify', scope: [:layouts, :breadcrumb])
|
= t('to_modify', scope: [:layouts, :breadcrumb])
|
||||||
|
|
||||||
%span.fr-badge.fr-badge--success.fr-mr-1w
|
%span.fr-badge.fr-badge--success.fr-mr-1w
|
||||||
|
|
|
@ -61,7 +61,7 @@
|
||||||
|
|
||||||
- elsif procedure.publiee?
|
- elsif procedure.publiee?
|
||||||
- if procedure.api_entreprise_token_expired_or_expires_soon?
|
- if procedure.api_entreprise_token_expired_or_expires_soon?
|
||||||
%span.fr-badge.fr-badge--sm.fr-badge--warning
|
%span.fr-badge.fr-badge--sm.fr-badge--error
|
||||||
= t('to_modify', scope: [:layouts, :breadcrumb])
|
= t('to_modify', scope: [:layouts, :breadcrumb])
|
||||||
%span.fr-badge.fr-badge--sm.fr-badge--success
|
%span.fr-badge.fr-badge--sm.fr-badge--success
|
||||||
= t('published', scope: [:layouts, :breadcrumb])
|
= t('published', scope: [:layouts, :breadcrumb])
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
= render partial: 'administrateurs/breadcrumbs',
|
= render partial: 'administrateurs/breadcrumbs',
|
||||||
locals: { steps: [['Démarches', admin_procedures_back_path(@procedure)],
|
locals: { steps: [['Démarches', admin_procedures_back_path(@procedure)],
|
||||||
[@procedure.libelle.truncate_words(10), admin_procedure_path(@procedure)],
|
[@procedure.libelle.truncate_words(10), admin_procedure_path(@procedure)],
|
||||||
['Jeton Entreprise']] }
|
['Jeton API Entreprise']] }
|
||||||
|
|
||||||
.fr-container
|
.fr-container
|
||||||
%h1.fr-h2 Jeton Entreprise
|
%h1.fr-h2 Jeton API Entreprise
|
||||||
|
|
||||||
= form_with model: @procedure, url: url_for({ controller: 'administrateurs/procedures', action: :update_jeton }) do |f|
|
= form_with model: @procedure, url: url_for({ controller: 'administrateurs/procedures', action: :update_jeton }) do |f|
|
||||||
.fr-container
|
.fr-container
|
||||||
|
@ -14,14 +14,16 @@
|
||||||
Démarches Simplifiées utilise
|
Démarches Simplifiées utilise
|
||||||
= link_to 'API Entreprise', "https://entreprise.api.gouv.fr/"
|
= link_to 'API Entreprise', "https://entreprise.api.gouv.fr/"
|
||||||
qui permet de récupérer les informations administratives des entreprises et des associations.
|
qui permet de récupérer les informations administratives des entreprises et des associations.
|
||||||
Si votre démarche nécessite des autorisations spécifiques que Démarches Simplifiées n’a pas par défaut, merci de renseigner ici le jeton
|
Si votre démarche nécessite des autorisations spécifiques que Démarches Simplifiées n’a pas par défaut, merci de renseigner ci dessous
|
||||||
= link_to 'API Entreprise', "https://api.gouv.fr/les-api/api-entreprise/demande-acces"
|
%strong le jeton API Entreprise
|
||||||
propre à votre démarche.
|
propre à votre démarche.
|
||||||
|
%p
|
||||||
|
Si besoin, vous pouvez demander une habilitation API Entreprise sur le site
|
||||||
|
= link_to 'api.gouv.fr.', "https://api.gouv.fr/les-api/api-entreprise/demande-acces"
|
||||||
|
|
||||||
|
|
||||||
= render partial: 'administrateurs/procedures/api_entreprise_token_expiration_alert', locals: { procedure: @procedure }
|
= render partial: 'administrateurs/procedures/api_entreprise_token_expiration_alert', locals: { procedure: @procedure }
|
||||||
|
|
||||||
.fr-input-group
|
= render Dsfr::InputComponent.new(form: f, attribute: :api_entreprise_token, input_type: :password_field, required: false, opts: { value: @procedure.read_attribute(:api_entreprise_token)})
|
||||||
= f.label :api_entreprise_token, "Jeton", class: 'fr-label'
|
|
||||||
= f.password_field :api_entreprise_token, value: @procedure.read_attribute(:api_entreprise_token), class: 'fr-input'
|
|
||||||
|
|
||||||
= render Procedure::FixedFooterComponent.new(procedure: @procedure, form: f)
|
= render Procedure::FixedFooterComponent.new(procedure: @procedure, form: f)
|
||||||
|
|
|
@ -27,6 +27,14 @@
|
||||||
= link_to 'Clore', admin_procedure_close_path(procedure_id: @procedure.id), class: 'fr-btn fr-btn--tertiary fr-btn--icon-left fr-icon-calendar-close-fill', id: "close-procedure-link"
|
= link_to 'Clore', admin_procedure_close_path(procedure_id: @procedure.id), class: 'fr-btn fr-btn--tertiary fr-btn--icon-left fr-icon-calendar-close-fill', id: "close-procedure-link"
|
||||||
|
|
||||||
.fr-container
|
.fr-container
|
||||||
|
- if @procedure.api_entreprise_token_expired_or_expires_soon?
|
||||||
|
= render Dsfr::AlertComponent.new(state: :error, title: t(:technical_issues, scope: [:administrateurs, :procedures]), extra_class_names: 'fr-mb-2w') do |c|
|
||||||
|
- c.with_body do
|
||||||
|
%ul.fr-mb-0
|
||||||
|
%li
|
||||||
|
= link_to "Jeton API Entreprise", jeton_admin_procedure_path(@procedure), class: 'error-anchor'
|
||||||
|
est expiré ou va expirer prochainement
|
||||||
|
|
||||||
- if @procedure.draft_changed?
|
- if @procedure.draft_changed?
|
||||||
= render Dsfr::CalloutComponent.new(title: t(:has_changes, scope: [:administrateurs, :revision_changes]), icon: "fr-fi-information-line") do |c|
|
= render Dsfr::CalloutComponent.new(title: t(:has_changes, scope: [:administrateurs, :revision_changes]), icon: "fr-fi-information-line") do |c|
|
||||||
- c.with_body do
|
- c.with_body do
|
||||||
|
|
|
@ -7,6 +7,7 @@ en:
|
||||||
attributes:
|
attributes:
|
||||||
procedure:
|
procedure:
|
||||||
hints:
|
hints:
|
||||||
|
api_entreprise_token: 'For example: eyJhbGciOiJIUzI1NiJ9.eyJ1...'
|
||||||
description: Describe in a few lines the context, the aim etc.
|
description: Describe in a few lines the context, the aim etc.
|
||||||
description_target_audience: Describe in a few lines the final recipients of the process, the eligibility criteria if there are any, the prerequisites, etc.
|
description_target_audience: Describe in a few lines the final recipients of the process, the eligibility criteria if there are any, the prerequisites, etc.
|
||||||
description_pj: Describe the required attachments list if there is any
|
description_pj: Describe the required attachments list if there is any
|
||||||
|
|
|
@ -7,6 +7,7 @@ fr:
|
||||||
attributes:
|
attributes:
|
||||||
procedure:
|
procedure:
|
||||||
hints:
|
hints:
|
||||||
|
api_entreprise_token: 'Exemple : eyJhbGciOiJIUzI1NiJ9.eyJ1...'
|
||||||
description: Décrivez en quelques lignes le contexte, la finalité, etc.
|
description: Décrivez en quelques lignes le contexte, la finalité, etc.
|
||||||
description_target_audience: Décrivez en quelques lignes les destinataires finaux de la démarche, les conditions d’éligibilité s’il y en a, les pré-requis, etc.
|
description_target_audience: Décrivez en quelques lignes les destinataires finaux de la démarche, les conditions d’éligibilité s’il y en a, les pré-requis, etc.
|
||||||
description_pj: Décrivez la liste des pièces jointes à fournir s’il y en a
|
description_pj: Décrivez la liste des pièces jointes à fournir s’il y en a
|
||||||
|
|
|
@ -67,6 +67,7 @@ en:
|
||||||
dpd_part_4: How to do ? You can either send him the link to the procedure on test stage by email, or name him "administrator". In any case, publish your approach only after having had his opinion.
|
dpd_part_4: How to do ? You can either send him the link to the procedure on test stage by email, or name him "administrator". In any case, publish your approach only after having had his opinion.
|
||||||
back_to_procedure: 'Cancel and return to the procedure page'
|
back_to_procedure: 'Cancel and return to the procedure page'
|
||||||
submit: Publish
|
submit: Publish
|
||||||
|
technical_issues: "Issues are affecting the proper functioning of the process"
|
||||||
check_path:
|
check_path:
|
||||||
path_not_available:
|
path_not_available:
|
||||||
owner: This URL is identical to another of your published procedures. If you publish this procedure, the old one will be unpublished and will no longer be accessible to the public.
|
owner: This URL is identical to another of your published procedures. If you publish this procedure, the old one will be unpublished and will no longer be accessible to the public.
|
||||||
|
|
|
@ -67,6 +67,7 @@ fr:
|
||||||
dpd_part_4: Comment faire ? Vous pouvez soit lui communiquer par email le lien vers la démarche en test, ou bien le nommer « administrateur ». Dans tous les cas, ne publiez votre démarche qu’après avoir eu son avis.
|
dpd_part_4: Comment faire ? Vous pouvez soit lui communiquer par email le lien vers la démarche en test, ou bien le nommer « administrateur ». Dans tous les cas, ne publiez votre démarche qu’après avoir eu son avis.
|
||||||
back_to_procedure: 'Annuler et revenir à la page de la démarche'
|
back_to_procedure: 'Annuler et revenir à la page de la démarche'
|
||||||
submit: Publier
|
submit: Publier
|
||||||
|
technical_issues: Des problèmes impactent le bon fonctionnement de la démarche
|
||||||
check_path:
|
check_path:
|
||||||
path_not_available:
|
path_not_available:
|
||||||
owner: Cette url est identique à celle d’une autre de vos démarches publiées. Si vous publiez cette démarche, l’ancienne sera dépubliée et ne sera plus accessible au public.
|
owner: Cette url est identique à celle d’une autre de vos démarches publiées. Si vous publiez cette démarche, l’ancienne sera dépubliée et ne sera plus accessible au public.
|
||||||
|
|
|
@ -83,8 +83,7 @@ describe Procedure::ErrorsSummary, type: :component do
|
||||||
include Logic
|
include Logic
|
||||||
|
|
||||||
let(:validation_context) { :publication }
|
let(:validation_context) { :publication }
|
||||||
let(:expired_token) { JWT.encode({ exp: 2.days.ago.to_i }, nil, 'none') }
|
let(:procedure) { create(:procedure, attestation_template:, initiated_mail:) }
|
||||||
let(:procedure) { create(:procedure, attestation_template:, initiated_mail:, api_entreprise_token: expired_token) }
|
|
||||||
let(:attestation_template) { build(:attestation_template) }
|
let(:attestation_template) { build(:attestation_template) }
|
||||||
let(:initiated_mail) { build(:initiated_mail) }
|
let(:initiated_mail) { build(:initiated_mail) }
|
||||||
|
|
||||||
|
@ -98,7 +97,6 @@ describe Procedure::ErrorsSummary, type: :component do
|
||||||
expect(page).to have_selector("a", text: "Les règles d’inéligibilité")
|
expect(page).to have_selector("a", text: "Les règles d’inéligibilité")
|
||||||
expect(page).to have_selector("a", text: "Le modèle d’attestation")
|
expect(page).to have_selector("a", text: "Le modèle d’attestation")
|
||||||
expect(page).to have_selector("a", text: "L’email de notification de passage de dossier en instruction")
|
expect(page).to have_selector("a", text: "L’email de notification de passage de dossier en instruction")
|
||||||
expect(page).to have_selector("a", text: "Jeton API Entreprise")
|
|
||||||
expect(page).to have_text("n'est pas valide", count: 2)
|
expect(page).to have_text("n'est pas valide", count: 2)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue