Remove prefill token expire at
This commit is contained in:
parent
d7592afdd1
commit
a6db8a6556
2 changed files with 1 additions and 14 deletions
|
@ -2,8 +2,6 @@ module Users
|
||||||
class CommencerController < ApplicationController
|
class CommencerController < ApplicationController
|
||||||
layout 'procedure_context'
|
layout 'procedure_context'
|
||||||
|
|
||||||
before_action :clean_prefil_session_if_needed, only: :commencer
|
|
||||||
|
|
||||||
def commencer
|
def commencer
|
||||||
@procedure = retrieve_procedure
|
@procedure = retrieve_procedure
|
||||||
return procedure_not_found if @procedure.blank? || @procedure.brouillon?
|
return procedure_not_found if @procedure.blank? || @procedure.brouillon?
|
||||||
|
@ -75,14 +73,6 @@ module Users
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
def clean_prefil_session_if_needed
|
|
||||||
if session[:prefill_token_expires_at] && session[:prefill_token_expires_at] < Time.zone.now
|
|
||||||
session.delete(:prefill_token)
|
|
||||||
session.delete(:prefill_token_expires_at)
|
|
||||||
session.delete(:prefill_params)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
def commencer_page_is_reloaded?
|
def commencer_page_is_reloaded?
|
||||||
session[:prefill_token].present? && session[:prefill_params] == params.to_unsafe_h
|
session[:prefill_token].present? && session[:prefill_params] == params.to_unsafe_h
|
||||||
end
|
end
|
||||||
|
@ -110,8 +100,7 @@ module Users
|
||||||
if @prefilled_dossier.save
|
if @prefilled_dossier.save
|
||||||
@prefilled_dossier.prefill!(PrefillParams.new(@prefilled_dossier, params.to_unsafe_h).to_a)
|
@prefilled_dossier.prefill!(PrefillParams.new(@prefilled_dossier, params.to_unsafe_h).to_a)
|
||||||
end
|
end
|
||||||
session[:prefill_token] = @prefilled_dossier.prefilled_token
|
session[:prefill_token] = @prefilled_dossier.prefill_token
|
||||||
session[:prefill_token_expires_at] = Time.zone.now + 5.minutes
|
|
||||||
session[:prefill_params] = params.to_unsafe_h
|
session[:prefill_params] = params.to_unsafe_h
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -144,7 +144,6 @@ module Users
|
||||||
|
|
||||||
def brouillon
|
def brouillon
|
||||||
session.delete(:prefill_token)
|
session.delete(:prefill_token)
|
||||||
session.delete(:prefill_token_expires_at)
|
|
||||||
session.delete(:prefill_params)
|
session.delete(:prefill_params)
|
||||||
@dossier = dossier_with_champs
|
@dossier = dossier_with_champs
|
||||||
@dossier.valid?(context: :prefilling)
|
@dossier.valid?(context: :prefilling)
|
||||||
|
@ -297,7 +296,6 @@ module Users
|
||||||
)
|
)
|
||||||
dossier.build_default_individual
|
dossier.build_default_individual
|
||||||
dossier.save!
|
dossier.save!
|
||||||
dossier.prefill!(PrefillParams.new(dossier, params.to_unsafe_h).to_a)
|
|
||||||
DossierMailer.with(dossier:).notify_new_draft.deliver_later
|
DossierMailer.with(dossier:).notify_new_draft.deliver_later
|
||||||
|
|
||||||
if dossier.procedure.for_individual
|
if dossier.procedure.for_individual
|
||||||
|
|
Loading…
Reference in a new issue