Merge pull request #10231 from colinux/fix-gouv-fr-banner
Tech: petites corrections pour le .gouv
This commit is contained in:
commit
8af3f07181
5 changed files with 21 additions and 16 deletions
|
@ -19,7 +19,9 @@
|
||||||
= render Dsfr::NoticeComponent.new(closable: true, data_attributes: { "data-switch-domain-notice" => true }) do |c|
|
= render Dsfr::NoticeComponent.new(closable: true, data_attributes: { "data-switch-domain-notice" => true }) do |c|
|
||||||
- c.with_title do
|
- c.with_title do
|
||||||
= t(".message_new_domain")
|
= t(".message_new_domain")
|
||||||
= "#{helpers.link_to APPLICATION_NAME, new_host_url}."
|
-# haml-lint:disable ApplicationNameLinter
|
||||||
|
= "#{helpers.link_to "demarches.gouv.fr", new_host_url}."
|
||||||
|
-# haml-lint:enable ApplicationNameLinter
|
||||||
|
|
||||||
- if manual_switch?
|
- if manual_switch?
|
||||||
= t(".follow_link")
|
= t(".follow_link")
|
||||||
|
@ -27,8 +29,8 @@
|
||||||
%span#banner_auto_switch_error.hidden= t(".detected_error")
|
%span#banner_auto_switch_error.hidden= t(".detected_error")
|
||||||
|
|
||||||
- if user && !user.preferred_domain_demarches_gouv_fr? && requested_from_new_domain?
|
- if user && !user.preferred_domain_demarches_gouv_fr? && requested_from_new_domain?
|
||||||
= form_tag(helpers.preferred_domain_path, method: :patch, remote: true, name: "update-preferred-domain")
|
= form_tag(helpers.preferred_domain_path, method: :patch, remote: true, name: "update-preferred-domain") do
|
||||||
:javascript
|
:javascript
|
||||||
document.addEventListener('noticeClosed', function(e) {
|
document.addEventListener('noticeClosed', function(e) {
|
||||||
document.forms['update-preferred-domain'].submit();
|
document.forms['update-preferred-domain'].submit();
|
||||||
});
|
});
|
||||||
|
|
|
@ -29,10 +29,9 @@ class ApplicationController < ActionController::Base
|
||||||
Current.user = current_user
|
Current.user = current_user
|
||||||
Current.browser = browser
|
Current.browser = browser
|
||||||
# TODO: remove this block when migration to new domain is done
|
# TODO: remove this block when migration to new domain is done
|
||||||
# headers['Host'] instead of request.host to keep the port (ex: localhost:3000)
|
Current.host = request.host_with_port
|
||||||
Current.host = request.headers['Host']
|
|
||||||
|
|
||||||
if Current.host.include?("gouv.fr")
|
if Current.host.include?(".gouv.fr")
|
||||||
Current.application_name = "demarches.gouv.fr"
|
Current.application_name = "demarches.gouv.fr"
|
||||||
Current.contact_email = "contact@demarches.gouv.fr"
|
Current.contact_email = "contact@demarches.gouv.fr"
|
||||||
Current.application_base_url = "https://demarches.gouv.fr"
|
Current.application_base_url = "https://demarches.gouv.fr"
|
||||||
|
|
|
@ -932,7 +932,7 @@ fr:
|
||||||
confirmation_mail_sent: "Nous venons de vous envoyer le mail de confirmation, veuillez cliquer sur le lien contenu dans ce mail pour fusionner vos comptes"
|
confirmation_mail_sent: "Nous venons de vous envoyer le mail de confirmation, veuillez cliquer sur le lien contenu dans ce mail pour fusionner vos comptes"
|
||||||
invalid_password: "Mauvais mot de passe"
|
invalid_password: "Mauvais mot de passe"
|
||||||
connection_done: "Les comptes FranceConnect et %{application_name} sont à présent fusionnés"
|
connection_done: "Les comptes FranceConnect et %{application_name} sont à présent fusionnés"
|
||||||
merger_token_expired: "Le délai pour fusionner les comptes FranceConnect et %{application_name} est expirée. Veuillez recommencer la procédure pour vous fusionner les comptes."
|
merger_token_expired: "Le délai pour fusionner les comptes FranceConnect et %{application_name} est expiré. Veuillez recommencer la procédure pour vous fusionner les comptes."
|
||||||
groupe_gestionnaires:
|
groupe_gestionnaires:
|
||||||
flash:
|
flash:
|
||||||
alert:
|
alert:
|
||||||
|
|
|
@ -51,7 +51,7 @@ RSpec.describe SwitchDomainBannerComponent, type: :component do
|
||||||
let(:path) { "/admin/procedures" }
|
let(:path) { "/admin/procedures" }
|
||||||
|
|
||||||
it "generate an url to the new domain" do
|
it "generate an url to the new domain" do
|
||||||
expect(rendered.to_html).to have_link(APPLICATION_NAME, href: "http://demarches.gouv.fr/admin/procedures")
|
expect(rendered.to_html).to have_link("demarches.gouv.fr", href: "http://demarches.gouv.fr/admin/procedures")
|
||||||
expect(rendered.to_html).not_to include("window.location")
|
expect(rendered.to_html).not_to include("window.location")
|
||||||
expect(rendered.to_html).to include("Suivez ce lien")
|
expect(rendered.to_html).to include("Suivez ce lien")
|
||||||
end
|
end
|
||||||
|
|
|
@ -159,7 +159,7 @@ describe FranceConnect::ParticulierController, type: :controller do
|
||||||
RSpec.shared_examples "a method that needs a valid merge token" do
|
RSpec.shared_examples "a method that needs a valid merge token" do
|
||||||
context 'when the merge token is invalid' do
|
context 'when the merge token is invalid' do
|
||||||
before do
|
before do
|
||||||
stub_const("APPLICATION_NAME", "demarches-simplifiees.fr")
|
allow(Current).to receive(:application_name).and_return('demarches-simplifiees.fr')
|
||||||
merge_token
|
merge_token
|
||||||
fci.update(merge_token_created_at: 2.years.ago)
|
fci.update(merge_token_created_at: 2.years.ago)
|
||||||
end
|
end
|
||||||
|
@ -171,7 +171,7 @@ describe FranceConnect::ParticulierController, type: :controller do
|
||||||
else
|
else
|
||||||
expect(subject).to redirect_to root_path
|
expect(subject).to redirect_to root_path
|
||||||
end
|
end
|
||||||
expect(flash.alert).to eq('Le délai pour fusionner les comptes FranceConnect et demarches-simplifiees.fr est expirée. Veuillez recommencer la procédure pour vous fusionner les comptes.')
|
expect(flash.alert).to eq('Le délai pour fusionner les comptes FranceConnect et demarches-simplifiees.fr est expiré. Veuillez recommencer la procédure pour vous fusionner les comptes.')
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -193,12 +193,12 @@ describe FranceConnect::ParticulierController, type: :controller do
|
||||||
let(:merge_token) { 'i do not exist' }
|
let(:merge_token) { 'i do not exist' }
|
||||||
|
|
||||||
before do
|
before do
|
||||||
stub_const("APPLICATION_NAME", "demarches-simplifiees.fr")
|
allow(Current).to receive(:application_name).and_return('demarches-simplifiees.fr')
|
||||||
end
|
end
|
||||||
|
|
||||||
it do
|
it do
|
||||||
expect(subject).to redirect_to root_path
|
expect(subject).to redirect_to root_path
|
||||||
expect(flash.alert).to eq("Le délai pour fusionner les comptes FranceConnect et demarches-simplifiees.fr est expirée. Veuillez recommencer la procédure pour vous fusionner les comptes.")
|
expect(flash.alert).to eq("Le délai pour fusionner les comptes FranceConnect et demarches-simplifiees.fr est expiré. Veuillez recommencer la procédure pour vous fusionner les comptes.")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -273,6 +273,10 @@ describe FranceConnect::ParticulierController, type: :controller do
|
||||||
context 'when the merge_token is ok and the user is found' do
|
context 'when the merge_token is ok and the user is found' do
|
||||||
subject { post :mail_merge_with_existing_account, params: { email_merge_token: } }
|
subject { post :mail_merge_with_existing_account, params: { email_merge_token: } }
|
||||||
|
|
||||||
|
before do
|
||||||
|
allow(Current).to receive(:application_name).and_return('demarches-simplifiees.fr')
|
||||||
|
end
|
||||||
|
|
||||||
let!(:user) { create(:user, email: email, password: 'abcdefgh') }
|
let!(:user) { create(:user, email: email, password: 'abcdefgh') }
|
||||||
|
|
||||||
it 'merges the account, signs in, and delete the merge token' do
|
it 'merges the account, signs in, and delete the merge token' do
|
||||||
|
@ -283,7 +287,7 @@ describe FranceConnect::ParticulierController, type: :controller do
|
||||||
expect(fci.merge_token).to be_nil
|
expect(fci.merge_token).to be_nil
|
||||||
expect(fci.email_merge_token).to be_nil
|
expect(fci.email_merge_token).to be_nil
|
||||||
expect(controller.current_user).to eq(user)
|
expect(controller.current_user).to eq(user)
|
||||||
expect(flash[:notice]).to eq("Les comptes FranceConnect et #{APPLICATION_NAME} sont à présent fusionnés")
|
expect(flash[:notice]).to eq("Les comptes FranceConnect et #{Current.application_name} sont à présent fusionnés")
|
||||||
end
|
end
|
||||||
|
|
||||||
context 'but the targeted user is an instructeur' do
|
context 'but the targeted user is an instructeur' do
|
||||||
|
|
Loading…
Reference in a new issue