Add automatically values on individual form if user is logged with FranceConnect
This commit is contained in:
parent
8ade790a81
commit
52bac4f3f9
2 changed files with 10 additions and 1 deletions
|
@ -48,6 +48,15 @@ class Users::DossiersController < UsersController
|
|||
@facade = facade
|
||||
@siret = current_user.siret unless current_user.siret.nil?
|
||||
|
||||
if @facade.procedure.for_individual? && current_user.loged_in_with_france_connect?
|
||||
individual = @facade.dossier.individual
|
||||
|
||||
individual.update_column :gender, @facade.dossier.france_connect_information.gender
|
||||
individual.update_column :nom, @facade.dossier.france_connect_information.family_name
|
||||
individual.update_column :prenom, @facade.dossier.france_connect_information.given_name
|
||||
individual.update_column :birthdate, @facade.dossier.france_connect_information.birthdate.strftime("%d/%m/%Y")
|
||||
end
|
||||
|
||||
rescue ActiveRecord::RecordNotFound
|
||||
flash.alert = t('errors.messages.dossier_not_found')
|
||||
redirect_to url_for users_dossiers_path
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
%label
|
||||
%h4
|
||||
Civilité
|
||||
= ff.select :gender, ['Monsieur', 'Madame']
|
||||
= ff.select :gender, ['Mr', 'Mme']
|
||||
.form-group
|
||||
%label
|
||||
%h4
|
||||
|
|
Loading…
Reference in a new issue