Sha256: 84b6b6bd437c90724d1e52fb66651f328af7d9bd68f88f00e7ff2050021fb6a8

Contents?: true

Size: 993 Bytes

Versions: 58

Compression:

Stored size: 993 Bytes

Contents

# frozen_string_literal: true

module Decidim
  # The controller to manage email confirmations for user groups.
  class GroupEmailConfirmationsController < Decidim::ApplicationController
    include FormFactory
    include UserGroups

    before_action :enforce_user_groups_enabled

    helper_method :user_group

    def create
      enforce_permission_to :manage, :user_group, user_group: user_group
      if user_group.email.blank?
        flash.keep[:alert] = t("decidim.profiles.user.fill_in_email_to_confirm_it")
        redirect_to(edit_group_path(user_group.nickname)) && return
      end

      user_group.send_confirmation_instructions

      flash.keep[:notice] = t("decidim.profiles.user.confirmation_instructions_sent")
      redirect_back(fallback_location: decidim.profile_path(user_group.nickname))
    end

    private

    def user_group
      @user_group ||= Decidim::UserGroups::ManageableUserGroups.for(current_user).find_by(nickname: params[:group_id])
    end
  end
end

Version data entries

58 entries across 58 versions & 1 rubygems

Version Path
decidim-core-0.27.9 app/controllers/decidim/group_email_confirmations_controller.rb
decidim-core-0.27.8 app/controllers/decidim/group_email_confirmations_controller.rb
decidim-core-0.27.7 app/controllers/decidim/group_email_confirmations_controller.rb
decidim-core-0.27.6 app/controllers/decidim/group_email_confirmations_controller.rb
decidim-core-0.26.10 app/controllers/decidim/group_email_confirmations_controller.rb
decidim-core-0.26.9 app/controllers/decidim/group_email_confirmations_controller.rb
decidim-core-0.27.5 app/controllers/decidim/group_email_confirmations_controller.rb
decidim-core-0.26.8 app/controllers/decidim/group_email_confirmations_controller.rb
decidim-core-0.27.4 app/controllers/decidim/group_email_confirmations_controller.rb
decidim-core-0.27.3 app/controllers/decidim/group_email_confirmations_controller.rb
decidim-core-0.26.7 app/controllers/decidim/group_email_confirmations_controller.rb
decidim-core-0.26.5 app/controllers/decidim/group_email_confirmations_controller.rb
decidim-core-0.27.2 app/controllers/decidim/group_email_confirmations_controller.rb
decidim-core-0.27.1 app/controllers/decidim/group_email_confirmations_controller.rb
decidim-core-0.26.4 app/controllers/decidim/group_email_confirmations_controller.rb
decidim-core-0.27.0 app/controllers/decidim/group_email_confirmations_controller.rb
decidim-core-0.26.3 app/controllers/decidim/group_email_confirmations_controller.rb
decidim-core-0.27.0.rc2 app/controllers/decidim/group_email_confirmations_controller.rb
decidim-core-0.27.0.rc1 app/controllers/decidim/group_email_confirmations_controller.rb
decidim-core-0.26.2 app/controllers/decidim/group_email_confirmations_controller.rb