feat(file retrieval): post targeted email

This commit is contained in:
simon lehericey 2023-12-13 09:44:28 +01:00
parent d86bebdd03
commit cd7fd5832c
3 changed files with 42 additions and 0 deletions

View file

@ -14,9 +14,14 @@ class RecoveriesController < ApplicationController
end
def identification
@structure_name = structure_name
end
def post_identification
# cookies are used to avoid leaking
# email in url
cookies[:recover_previous_email] = previous_email
redirect_to selection_recovery_path
end
@ -39,6 +44,12 @@ class RecoveriesController < ApplicationController
def siret = current_instructeur.agent_connect_information.siret
def previous_email = params[:previous_email]
def structure_name
# we know that the structure exists because
# of the ensure_collectivite_territoriale guard
APIRechercheEntreprisesService.new.(siret:).value![:nom_complet]
end
def ensure_agent_connect_is_used
if current_instructeur&.agent_connect_information.nil?
redirect_to support_recovery_path(error: :must_use_agent_connect)