From 3bcdc5a00fc40dbed4d829ee986a2dd3f4848dc8 Mon Sep 17 00:00:00 2001 From: f Date: Sun, 28 Feb 2021 11:00:48 -0300 Subject: [PATCH] autenticar la subida de archivos MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit activestorage permite subida de archivos sin autenticación! --- .../authenticated_direct_uploads_controller.rb | 11 +++++++++++ config/application.rb | 2 ++ 2 files changed, 13 insertions(+) create mode 100644 app/controllers/concerns/active_storage/authenticated_direct_uploads_controller.rb diff --git a/app/controllers/concerns/active_storage/authenticated_direct_uploads_controller.rb b/app/controllers/concerns/active_storage/authenticated_direct_uploads_controller.rb new file mode 100644 index 00000000..6ba009b7 --- /dev/null +++ b/app/controllers/concerns/active_storage/authenticated_direct_uploads_controller.rb @@ -0,0 +1,11 @@ +# frozen_string_literal: true + +module ActiveStorage + module AuthenticatedDirectUploadsController + extend ActiveSupport::Concern + + included do + before_action :authenticate_usuarie! + end + end +end diff --git a/config/application.rb b/config/application.rb index c7afe9d8..7326ae0f 100644 --- a/config/application.rb +++ b/config/application.rb @@ -39,6 +39,8 @@ module Sutty config.active_storage.variant_processor = :vips config.after_initialize do + ActiveStorage::DirectUploadsController.include ActiveStorage::AuthenticatedDirectUploadsController + I18n.available_locales.each do |locale| translations = I18n.t(:email_address, locale: locale)