locomotivecms/engine

View on GitHub
app/controllers/locomotive/concerns/ssl_controller.rb

Summary

Maintainability
A
0 mins
Test Coverage
module Locomotive
  module Concerns
    module SslController

      extend ActiveSupport::Concern

      included do

        before_action :require_ssl

      end

      private

      def require_ssl
        # already a ssl request or ssl disabled ?
        return if !Locomotive.config.enable_admin_ssl || request.ssl?

        redirect_to protocol: 'https://'
      end

    end
  end
end