spree/spree_social

View on GitHub
app/controllers/spree/admin/authentication_methods_controller.rb

Summary

Maintainability
A
0 mins
Test Coverage
module Spree
  module Admin
    class AuthenticationMethodsController < ResourceController
      create.after :update_oauth_method
      update.after :update_oauth_method

      private

      def update_oauth_method
        auth_method = params[:authentication_method]
        return unless auth_method[:active] == 'true' && auth_method[:environment] == ::Rails.env
        Devise.setup do |config|
          config.omniauth auth_method[:provider], auth_method[:api_key], auth_method[:api_secret]
        end
      end
    end
  end
end