Sha256: cfbaff400925be7789ceb8e73a2bc55e4280f3c32704521d4b41e191d9363805

Contents?: true

Size: 1.06 KB

Versions: 46

Compression:

Stored size: 1.06 KB

Contents

# frozen_string_literal: true

module Decidim
  module Devise
    # Custom Devise PasswordsController to avoid namespace problems.
    class PasswordsController < ::Devise::PasswordsController
      include Decidim::DeviseControllers

      before_action :check_sign_in_enabled

      private

      def check_sign_in_enabled
        redirect_to new_user_session_path unless current_organization.sign_in_enabled?
      end

      # Since we're using a single Devise installation for multiple
      # organizations, and user emails can be repeated across organizations,
      # we need to identify the user by both the email and the organization.
      # Setting the organization ID here will be used by Devise internally to
      # find the correct user.
      #
      # Note that in order for this to work we need to define the `reset_password_keys`
      # Devise attribute in the `Decidim::User` model to include the
      # `decidim_organization_id` attribute.
      def resource_params
        super.merge(decidim_organization_id: current_organization.id)
      end
    end
  end
end

Version data entries

46 entries across 46 versions & 1 rubygems

Version Path
decidim-core-0.26.10 app/controllers/decidim/devise/passwords_controller.rb
decidim-core-0.26.9 app/controllers/decidim/devise/passwords_controller.rb
decidim-core-0.26.8 app/controllers/decidim/devise/passwords_controller.rb
decidim-core-0.26.7 app/controllers/decidim/devise/passwords_controller.rb
decidim-core-0.26.5 app/controllers/decidim/devise/passwords_controller.rb
decidim-core-0.26.4 app/controllers/decidim/devise/passwords_controller.rb
decidim-core-0.26.3 app/controllers/decidim/devise/passwords_controller.rb
decidim-core-0.26.2 app/controllers/decidim/devise/passwords_controller.rb
decidim-core-0.26.1 app/controllers/decidim/devise/passwords_controller.rb
decidim-core-0.26.0 app/controllers/decidim/devise/passwords_controller.rb
decidim-core-0.26.0.rc2 app/controllers/decidim/devise/passwords_controller.rb
decidim-core-0.26.0.rc1 app/controllers/decidim/devise/passwords_controller.rb
decidim-core-0.25.2 app/controllers/decidim/devise/passwords_controller.rb
decidim-core-0.25.1 app/controllers/decidim/devise/passwords_controller.rb
decidim-core-0.25.0 app/controllers/decidim/devise/passwords_controller.rb
decidim-core-0.25.0.rc4 app/controllers/decidim/devise/passwords_controller.rb
decidim-core-0.25.0.rc3 app/controllers/decidim/devise/passwords_controller.rb
decidim-core-0.25.0.rc2 app/controllers/decidim/devise/passwords_controller.rb
decidim-core-0.25.0.rc1 app/controllers/decidim/devise/passwords_controller.rb
decidim-core-0.24.3 app/controllers/decidim/devise/passwords_controller.rb