Sha256: febd1c5f0cf8c365c7ac1f843939e9b3b08a38eeb16ac7d54bb7c2aceaff15a7

Contents?: true

Size: 1.34 KB

Versions: 14

Compression:

Stored size: 1.34 KB

Contents

# frozen_string_literal: true

module Decidim
  module Verifications
    module IdDocuments
      module Admin
        #
        # Handles confirmations for verification by identity document upload.
        #
        class ConfirmationsController < Decidim::Admin::ApplicationController
          layout "decidim/admin/users"

          before_action :load_pending_authorization

          def new
            authorize! :update, @pending_authorization

            @form = InformationForm.new
          end

          def create
            authorize! :update, @pending_authorization

            @form = InformationForm.from_params(params)

            ConfirmUserAuthorization.call(@pending_authorization, @form) do
              on(:ok) do
                flash[:notice] = t("confirmations.create.success", scope: "decidim.verifications.id_documents.admin")
                redirect_to pending_authorizations_path
              end

              on(:invalid) do
                flash.now[:alert] = t("confirmations.create.error", scope: "decidim.verifications.id_documents.admin")
                render action: :new
              end
            end
          end

          private

          def load_pending_authorization
            @pending_authorization = Authorization.find(params[:pending_authorization_id])
          end
        end
      end
    end
  end
end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
decidim-verifications-0.11.2 app/controllers/decidim/verifications/id_documents/admin/confirmations_controller.rb
decidim-verifications-0.11.1 app/controllers/decidim/verifications/id_documents/admin/confirmations_controller.rb
decidim-verifications-0.11.0.pre1 app/controllers/decidim/verifications/id_documents/admin/confirmations_controller.rb
decidim-verifications-0.10.1 app/controllers/decidim/verifications/id_documents/admin/confirmations_controller.rb
decidim-verifications-0.10.0 app/controllers/decidim/verifications/id_documents/admin/confirmations_controller.rb
decidim-verifications-0.9.3 app/controllers/decidim/verifications/id_documents/admin/confirmations_controller.rb
decidim-verifications-0.9.2 app/controllers/decidim/verifications/id_documents/admin/confirmations_controller.rb
decidim-verifications-0.9.1 app/controllers/decidim/verifications/id_documents/admin/confirmations_controller.rb
decidim-verifications-0.9.0 app/controllers/decidim/verifications/id_documents/admin/confirmations_controller.rb
decidim-verifications-0.8.4 app/controllers/decidim/verifications/id_documents/admin/confirmations_controller.rb
decidim-verifications-0.8.3 app/controllers/decidim/verifications/id_documents/admin/confirmations_controller.rb
decidim-verifications-0.8.2 app/controllers/decidim/verifications/id_documents/admin/confirmations_controller.rb
decidim-verifications-0.8.1 app/controllers/decidim/verifications/id_documents/admin/confirmations_controller.rb
decidim-verifications-0.8.0 app/controllers/decidim/verifications/id_documents/admin/confirmations_controller.rb