Layout : ajoute les vues pour confirmer le mail fc ou en choisir un autre
This commit is contained in:
parent
fb5968bf25
commit
c51cf7e048
6 changed files with 121 additions and 13 deletions
|
@ -0,0 +1,32 @@
|
||||||
|
import { ApplicationController } from './application_controller';
|
||||||
|
|
||||||
|
export class EmailFranceConnectController extends ApplicationController {
|
||||||
|
static targets = ['useFranceConnectEmail', 'emailField'];
|
||||||
|
|
||||||
|
emailFieldTarget!: HTMLInputElement;
|
||||||
|
useFranceConnectEmailTargets!: HTMLInputElement[];
|
||||||
|
|
||||||
|
connect() {
|
||||||
|
this.triggerEmailField();
|
||||||
|
}
|
||||||
|
|
||||||
|
triggerEmailField() {
|
||||||
|
const checkedTarget = this.useFranceConnectEmailTargets.find(
|
||||||
|
(target) => target.checked
|
||||||
|
);
|
||||||
|
|
||||||
|
const inputElement = this.emailFieldTarget.querySelector(
|
||||||
|
'input'
|
||||||
|
) as HTMLInputElement;
|
||||||
|
|
||||||
|
if (checkedTarget && checkedTarget.value === 'false') {
|
||||||
|
this.emailFieldTarget.classList.remove('fr-hidden');
|
||||||
|
inputElement.setAttribute('required', '');
|
||||||
|
this.emailFieldTarget.required = true;
|
||||||
|
} else {
|
||||||
|
this.emailFieldTarget.classList.add('fr-hidden');
|
||||||
|
inputElement.removeAttribute('required');
|
||||||
|
inputElement.value = '';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
34
app/views/france_connect/particulier/choose_email.html.haml
Normal file
34
app/views/france_connect/particulier/choose_email.html.haml
Normal file
|
@ -0,0 +1,34 @@
|
||||||
|
.fr-container
|
||||||
|
%h1.text-center.mt-1= t('.choose_email_contact')
|
||||||
|
|
||||||
|
%p= t('.greetings')
|
||||||
|
|
||||||
|
%p= t('.intro_html', email: france_connect_email)
|
||||||
|
|
||||||
|
%p= t('.use_email_for_notifications')
|
||||||
|
|
||||||
|
= form_with url: france_connect_particulier_associate_user_path, method: :post, data: { controller: "email-france-connect" } do |f|
|
||||||
|
= hidden_field_tag :france_connect_email, france_connect_email
|
||||||
|
= hidden_field_tag :merge_token, merge_token
|
||||||
|
|
||||||
|
%fieldset.fr-fieldset
|
||||||
|
%legend.fr-fieldset__legend
|
||||||
|
.fr-fieldset__element.fr-fieldset__element--inline
|
||||||
|
.fr-radio-group
|
||||||
|
= f.radio_button :use_france_connect_email, true, id: 'use_france_connect_email_yes', class: 'fr-radio', required: true, data: { action: "email-france-connect#triggerEmailField", email_france_connect_target: "useFranceConnectEmail" }
|
||||||
|
%label.fr-label{ for: 'use_france_connect_email_yes' }
|
||||||
|
= t('.yes')
|
||||||
|
.fr-fieldset__element.fr-fieldset__element--inline
|
||||||
|
.fr-radio-group
|
||||||
|
= f.radio_button :use_france_connect_email, false, id: 'use_france_connect_email_no', class: 'fr-radio', required: true, data: { action: "email-france-connect#triggerEmailField", email_france_connect_target: "useFranceConnectEmail" }
|
||||||
|
%label.fr-label{ for: 'use_france_connect_email_no' }
|
||||||
|
= t('.no')
|
||||||
|
|
||||||
|
.fr-fieldset.fr-w-30v
|
||||||
|
.fr-fieldset__element.fr-fieldset__element--inline.fr-hidden{ data: { email_france_connect_target: "emailField" } }
|
||||||
|
= f.label :alternative_email, t('.alternative_email'), class: "fr-label"
|
||||||
|
%span.fr-hint-text.mb-1= t('activerecord.attributes.user.hints.email')
|
||||||
|
= f.email_field :alternative_email, class: "fr-input"
|
||||||
|
|
||||||
|
%div
|
||||||
|
= f.submit t('.confirm'), class: 'fr-btn'
|
|
@ -0,0 +1,8 @@
|
||||||
|
.fr-container
|
||||||
|
%h1.text-center.mt-1= t('.confirmation_sent_by_email')
|
||||||
|
|
||||||
|
%p= t('.intro', email: email)
|
||||||
|
|
||||||
|
%p= t('.click_the_link_in_the_email')
|
||||||
|
|
||||||
|
= link_to t('.continue'), destination_path, class: 'fr-btn'
|
|
@ -1,20 +1,21 @@
|
||||||
= content_for :title, "Fusion des comptes FC et #{Current.application_name}"
|
= content_for :title, "Fusion des comptes FC et #{Current.application_name}"
|
||||||
|
|
||||||
.container
|
.fr-container
|
||||||
%h1.page-title= t('.title', application_name: Current.application_name)
|
%h1.page-title= t('.title', application_name: Current.application_name)
|
||||||
|
|
||||||
%p= t('.subtitle_html', email: @fci.email_france_connect, application_name: Current.application_name)
|
%p= t('.subtitle_html', email: @fci.email_france_connect, application_name: Current.application_name)
|
||||||
|
|
||||||
.form.mt-2
|
%fieldset.fr-fieldset
|
||||||
%label= t('.label_select_merge_flow', email: @fci.email_france_connect)
|
%legend.fr-fieldset__legend= t('.label_select_merge_flow', email: @fci.email_france_connect)
|
||||||
%fieldset.radios
|
.fr-fieldset__element.fr-fieldset__element--inline
|
||||||
%label{ onclick: "DS.showFusion(event);" }
|
.fr-radio-group
|
||||||
= radio_button_tag :value, true, false, autocomplete: "off", id: 'it-is-mine'
|
%input{ type: 'radio', id: 'it-is-mine', name: 'value', value: 'true', autocomplete: "off", onclick: "DS.showFusion(event);" }
|
||||||
= t('utils.yes')
|
%label{ for: 'it-is-mine' }= t('utils.yes')
|
||||||
|
.fr-fieldset__element.fr-fieldset__element--inline
|
||||||
|
.fr-radio-group
|
||||||
|
%input{ type: 'radio', id: 'it-is-not-mine', name: 'value', value: 'false', autocomplete: "off", onclick: "DS.showNewAccount(event);" }
|
||||||
|
%label{ for: 'it-is-not-mine' }= t('utils.no')
|
||||||
|
|
||||||
%label{ onclick: "DS.showNewAccount(event);" }
|
|
||||||
= radio_button_tag :value, false, false, autocomplete: "off", id: 'it-is-not-mine'
|
|
||||||
= t('utils.no')
|
|
||||||
|
|
||||||
.fusion.hidden
|
.fusion.hidden
|
||||||
%p= t('.title_fill_in_password')
|
%p= t('.title_fill_in_password')
|
||||||
|
@ -38,9 +39,9 @@
|
||||||
|
|
||||||
= form_tag france_connect_particulier_merge_with_new_account_path, data: { turbo: true }, class: 'mt-2 form' do
|
= form_tag france_connect_particulier_merge_with_new_account_path, data: { turbo: true }, class: 'mt-2 form' do
|
||||||
= hidden_field_tag :merge_token, @fci.merge_token, id: dom_id(@fci, :new_account_merge_token)
|
= hidden_field_tag :merge_token, @fci.merge_token, id: dom_id(@fci, :new_account_merge_token)
|
||||||
= label_tag :email, t('views.registrations.new.email_label'), for: dom_id(@fci, :new_account_email)
|
= label_tag :email, t('views.registrations.new.email_label'), for: dom_id(@fci, :new_account_email), class: 'fr-label'
|
||||||
= email_field_tag :email, "", required: true, id: dom_id(@fci, :new_account_email)
|
= email_field_tag :email, "", required: true, id: dom_id(@fci, :new_account_email), class: 'mb-1 fr-input'
|
||||||
= submit_tag t('.button_use_this_email'), class: 'button primary'
|
= submit_tag t('.button_use_this_email'), class: 'fr-btn'
|
||||||
|
|
||||||
|
|
||||||
#new-account-password-confirmation.hidden
|
#new-account-password-confirmation.hidden
|
||||||
|
|
|
@ -0,0 +1,11 @@
|
||||||
|
.fr-container
|
||||||
|
%h1.text-center.mt-1 Renvoyer le lien de confirmation
|
||||||
|
|
||||||
|
%p Bonjour #{@user.email}
|
||||||
|
|
||||||
|
%p Cliquez sur le bouton ci-dessous pour recevoir un nouveau lien de confirmation à votre adresse email.
|
||||||
|
|
||||||
|
= form_with url: france_connect_post_resend_confirmation_path, method: :post, local: true do |form|
|
||||||
|
= form.hidden_field :token, value: @user.confirmation_token
|
||||||
|
.form-group
|
||||||
|
= form.submit "Renvoyer le lien de confirmation", class: 'fr-btn'
|
|
@ -0,0 +1,22 @@
|
||||||
|
- content_for(:title, 'Confirmez votre email')
|
||||||
|
%p
|
||||||
|
Bonjour
|
||||||
|
= @user.email
|
||||||
|
!
|
||||||
|
|
||||||
|
%p
|
||||||
|
Veuillez confirmer votre email en cliquant sur le lien ci-dessous:
|
||||||
|
= round_button 'Je confirme', france_connect_confirm_email_url(@token), :primary
|
||||||
|
|
||||||
|
|
||||||
|
%p Ce lien est valide #{distance_of_time_in_words(FranceConnectInformation::CONFIRMATION_EMAIL_VALIDITY)}.
|
||||||
|
|
||||||
|
%p
|
||||||
|
Tant que vous n'aurez pas confirmé votre email, vous ne recevrez aucune notification sur l'avancement de vos dossiers.
|
||||||
|
|
||||||
|
%p
|
||||||
|
Si vous n’êtes pas à l’origine de cette demande, vous pouvez ignorer ce message. Et si vous avez besoin d’assistance, n’hésitez pas à nous contacter à
|
||||||
|
= succeed '.' do
|
||||||
|
= mail_to CONTACT_EMAIL
|
||||||
|
|
||||||
|
= render partial: "layouts/mailers/signature"
|
Loading…
Reference in a new issue