Class: Decidim::Verifications::Sms::AuthorizationsController
- Inherits:
-
ApplicationController
- Object
- ApplicationController
- ApplicationController
- Decidim::Verifications::Sms::AuthorizationsController
- Includes:
- Renewable
- Defined in:
- app/controllers/decidim/verifications/sms/authorizations_controller.rb
Instance Method Summary collapse
Methods inherited from ApplicationController
Instance Method Details
#create ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'app/controllers/decidim/verifications/sms/authorizations_controller.rb', line 17 def create (:create, :authorization, authorization:) @form = MobilePhoneForm.from_params(params.merge(user: current_user)) PerformAuthorizationStep.call(, @form) do on(:ok) do flash[:notice] = t("authorizations.create.success", scope: "decidim.verifications.sms") = Decidim::Verifications::Adapter.from_element(.name) redirect_to .(redirect_url:) end on(:invalid) do flash.now[:alert] = t("authorizations.create.error", scope: "decidim.verifications.sms") render :new end end end |
#destroy ⇒ Object
60 61 62 63 64 65 66 67 |
# File 'app/controllers/decidim/verifications/sms/authorizations_controller.rb', line 60 def destroy (:destroy, :authorization, authorization:) .destroy! flash[:notice] = t("authorizations.destroy.success", scope: "decidim.verifications.sms") redirect_to action: :new end |
#edit ⇒ Object
35 36 37 38 39 |
# File 'app/controllers/decidim/verifications/sms/authorizations_controller.rb', line 35 def edit (:update, :authorization, authorization:) @form = ConfirmationForm.from_params(params) end |
#new ⇒ Object
11 12 13 14 15 |
# File 'app/controllers/decidim/verifications/sms/authorizations_controller.rb', line 11 def new (:create, :authorization, authorization:) @form = MobilePhoneForm.new end |
#update ⇒ Object
41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 |
# File 'app/controllers/decidim/verifications/sms/authorizations_controller.rb', line 41 def update (:update, :authorization, authorization:) @form = ConfirmationForm.from_params(params) ConfirmUserAuthorization.call(, @form, session) do on(:ok) do flash[:notice] = t("authorizations.update.success", scope: "decidim.verifications.sms") redirect_to redirect_url || decidim_verifications. end on(:invalid) do flash.now[:alert] = t("authorizations.update.error", scope: "decidim.verifications.sms") render :edit end end end |