Sha256: 918df83f87f9b3af0cb7038140cc4df6ae77296450a3ee581d7b7c98636f6f60

Contents?: true

Size: 1.37 KB

Versions: 1

Compression:

Stored size: 1.37 KB

Contents

require "active_support/concern"

module Renalware
  module Concerns::DeviseControllerMethods
    extend ActiveSupport::Concern

    included do
      class_eval do
        before_action :authenticate_user!
        before_action :configure_permitted_parameters, if: :devise_controller?
      end

      protected

      def configure_permitted_parameters
        configure_sign_up_parameters
        configure_sign_in_parameters
        configure_account_update_parameters
      end

      def configure_sign_up_parameters
        devise_parameter_sanitizer.permit(
          :sign_up,
          keys: [
            :given_name,
            :family_name,
            :username,
            :email,
            :password,
            :password_confirmation,
            :remember_me
          ]
        )
      end

      def configure_sign_in_parameters
        devise_parameter_sanitizer.permit(:sign_in, keys: [:username, :password, :remember_me])
      end

      def configure_account_update_parameters
        devise_parameter_sanitizer.permit(
          :account_update,
          keys: [
              :given_name,
              :family_name,
              :username,
              :email,
              :password,
              :password_confirmation,
              :current_password,
              :professional_position,
              :signature
          ]
        )
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
renalware-core-2.0.0.pre.beta12 app/controllers/renalware/concerns/devise_controller_methods.rb