Class: Decidim::Verifications::AuthorizationsController

Inherits:
ApplicationController show all
Includes:
UserProfile
Defined in:
app/controllers/decidim/verifications/authorizations_controller.rb

Overview

This controller allows users to create and destroy their authorizations. It shouldn’t be necessary to expand it to add new authorization schemes.

Instance Method Summary collapse

Instance Method Details

#createObject



35
36
37
38
39
40
41
42
43
44
45
46
47
# File 'app/controllers/decidim/verifications/authorizations_controller.rb', line 35

def create
  AuthorizeUser.call(handler) do
    on(:ok) do
      flash[:notice] = t("authorizations.create.success", scope: "decidim.verifications")
      redirect_to redirect_url || authorizations_path
    end

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

#first_loginObject



25
26
27
28
29
30
31
32
33
# File 'app/controllers/decidim/verifications/authorizations_controller.rb', line 25

def 
  if unauthorized_methods.length == 1
    redirect_to(
      action: :new,
      handler: unauthorized_methods.first.name,
      redirect_url: decidim.
    )
  end
end

#indexObject



20
21
22
23
# File 'app/controllers/decidim/verifications/authorizations_controller.rb', line 20

def index
  @granted_authorizations = granted_authorizations
  @pending_authorizations = pending_authorizations
end

#newObject



18
# File 'app/controllers/decidim/verifications/authorizations_controller.rb', line 18

def new; end