[Fix #592] mutualize sanitize and clean flash messages

This commit is contained in:
Simon Lehericey 2017-07-13 09:46:13 +02:00
parent 4ae9d8ef0d
commit 693c2a43ac
8 changed files with 14 additions and 14 deletions

View file

@ -69,16 +69,16 @@ class Users::DescriptionController < UsersController
unless params[:cerfa_pdf].nil?
cerfa = Cerfa.new(content: params[:cerfa_pdf], dossier: @dossier, user: current_user)
unless cerfa.save
flash.alert = cerfa.errors.full_messages.join('<br />').html_safe
flash.alert = cerfa.errors.full_messages
end
end
end
if !((errors_upload = PiecesJustificativesService.upload!(@dossier, current_user, params)).empty?)
if flash.alert.nil?
flash.alert = errors_upload.join('<br>').html_safe
flash.alert = errors_upload
else
flash.alert = (flash.alert + '<br />' + errors_upload.join('<br>').html_safe).html_safe
flash.alert = [flash.alert] + errors_upload
end
else
@ -100,7 +100,7 @@ class Users::DescriptionController < UsersController
private
def redirect_to_description_with_errors(dossier, errors)
flash.alert = errors.join('<br>')
flash.alert = errors
redirect_to users_dossier_description_path(dossier_id: dossier.id)
end

View file

@ -133,7 +133,7 @@ class Users::DossiersController < UsersController
if checked_autorisation_donnees?
unless Dossier.find(@facade.dossier.id).update_attributes update_params_with_formatted_birthdate
flash.alert = @facade.dossier.errors.full_messages.join('<br />').html_safe
flash.alert = @facade.dossier.errors.full_messages
return redirect_to users_dossier_path(id: @facade.dossier.id)
end