Sha256: 49e1c969342ba9db2fdc792206222313aa7727f32a601e2b6549c57b33afc952

Contents?: true

Size: 1.43 KB

Versions: 26

Compression:

Stored size: 1.43 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
            enforce_permission_to :update, :authorization, authorization: @pending_authorization

            @form = InformationForm.new
          end

          def create
            enforce_permission_to :update, :authorization, authorization: @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

26 entries across 26 versions & 1 rubygems

Version Path
decidim-verifications-0.21.0 app/controllers/decidim/verifications/id_documents/admin/confirmations_controller.rb
decidim-verifications-0.20.1 app/controllers/decidim/verifications/id_documents/admin/confirmations_controller.rb
decidim-verifications-0.20.0 app/controllers/decidim/verifications/id_documents/admin/confirmations_controller.rb
decidim-verifications-0.19.1 app/controllers/decidim/verifications/id_documents/admin/confirmations_controller.rb
decidim-verifications-0.18.1 app/controllers/decidim/verifications/id_documents/admin/confirmations_controller.rb
decidim-verifications-0.19.0 app/controllers/decidim/verifications/id_documents/admin/confirmations_controller.rb
decidim-verifications-0.17.2 app/controllers/decidim/verifications/id_documents/admin/confirmations_controller.rb
decidim-verifications-0.18.0 app/controllers/decidim/verifications/id_documents/admin/confirmations_controller.rb
decidim-verifications-0.17.1 app/controllers/decidim/verifications/id_documents/admin/confirmations_controller.rb
decidim-verifications-0.16.1 app/controllers/decidim/verifications/id_documents/admin/confirmations_controller.rb
decidim-verifications-0.17.0 app/controllers/decidim/verifications/id_documents/admin/confirmations_controller.rb
decidim-verifications-0.16.0 app/controllers/decidim/verifications/id_documents/admin/confirmations_controller.rb
decidim-verifications-0.15.2 app/controllers/decidim/verifications/id_documents/admin/confirmations_controller.rb
decidim-verifications-0.15.1 app/controllers/decidim/verifications/id_documents/admin/confirmations_controller.rb
decidim-verifications-0.15.0 app/controllers/decidim/verifications/id_documents/admin/confirmations_controller.rb
decidim-verifications-0.14.4 app/controllers/decidim/verifications/id_documents/admin/confirmations_controller.rb
decidim-verifications-0.14.3 app/controllers/decidim/verifications/id_documents/admin/confirmations_controller.rb
decidim-verifications-0.14.2 app/controllers/decidim/verifications/id_documents/admin/confirmations_controller.rb
decidim-verifications-0.14.1 app/controllers/decidim/verifications/id_documents/admin/confirmations_controller.rb
decidim-verifications-0.13.1 app/controllers/decidim/verifications/id_documents/admin/confirmations_controller.rb