Sha256: 43bd1599657e80cf6549cddce6a57183b543015affe8f0dec01c5795590ff7ea

Contents?: true

Size: 915 Bytes

Versions: 3

Compression:

Stored size: 915 Bytes

Contents

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

      private

      # 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 orther 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

3 entries across 3 versions & 1 rubygems

Version Path
decidim-core-0.1.0 app/controllers/decidim/devise/passwords_controller.rb
decidim-core-0.0.8.1 app/controllers/decidim/devise/passwords_controller.rb
decidim-core-0.0.7 app/controllers/decidim/devise/passwords_controller.rb