Sha256: 43c89ceffb766db67a937404ae1435f3808d152a449780164b1dc8649153a567

Contents?: true

Size: 525 Bytes

Versions: 50

Compression:

Stored size: 525 Bytes

Contents

# frozen_string_literal: true

require "active_support/concern"

module Decidim
  module UserBlockedChecker
    extend ActiveSupport::Concern

    included do
      before_action :check_user_not_blocked
    end

    def check_user_not_blocked
      check_user_block_status(current_user)
    end

    def check_user_block_status(user)
      if user.present? && user.blocked?
        sign_out user
        flash.delete(:notice)
        flash[:error] = t("decidim.account.blocked")
        root_path
      end
    end
  end
end

Version data entries

50 entries across 50 versions & 1 rubygems

Version Path
decidim-core-0.26.8 app/controllers/concerns/decidim/user_blocked_checker.rb
decidim-core-0.27.4 app/controllers/concerns/decidim/user_blocked_checker.rb
decidim-core-0.27.3 app/controllers/concerns/decidim/user_blocked_checker.rb
decidim-core-0.26.7 app/controllers/concerns/decidim/user_blocked_checker.rb
decidim-core-0.26.5 app/controllers/concerns/decidim/user_blocked_checker.rb
decidim-core-0.27.2 app/controllers/concerns/decidim/user_blocked_checker.rb
decidim-core-0.27.1 app/controllers/concerns/decidim/user_blocked_checker.rb
decidim-core-0.26.4 app/controllers/concerns/decidim/user_blocked_checker.rb
decidim-core-0.27.0 app/controllers/concerns/decidim/user_blocked_checker.rb
decidim-core-0.26.3 app/controllers/concerns/decidim/user_blocked_checker.rb
decidim-core-0.27.0.rc2 app/controllers/concerns/decidim/user_blocked_checker.rb
decidim-core-0.27.0.rc1 app/controllers/concerns/decidim/user_blocked_checker.rb
decidim-core-0.26.2 app/controllers/concerns/decidim/user_blocked_checker.rb
decidim-core-0.26.1 app/controllers/concerns/decidim/user_blocked_checker.rb
decidim-core-0.26.0 app/controllers/concerns/decidim/user_blocked_checker.rb
decidim-core-0.26.0.rc2 app/controllers/concerns/decidim/user_blocked_checker.rb
decidim-core-0.26.0.rc1 app/controllers/concerns/decidim/user_blocked_checker.rb
decidim-core-0.25.2 app/controllers/concerns/decidim/user_blocked_checker.rb
decidim-core-0.25.1 app/controllers/concerns/decidim/user_blocked_checker.rb
decidim-core-0.25.0 app/controllers/concerns/decidim/user_blocked_checker.rb