Sha256: e5a9ee7c5d917000728e01fb0c9f690431e3aecdd1639da09d2e669dd6bfb372

Contents?: true

Size: 628 Bytes

Versions: 31

Compression:

Stored size: 628 Bytes

Contents

# frozen_string_literal: true

module Alchemy
  module SSLProtection
    private

    # Enforce ssl for login and all admin modules.
    #
    # Default is +false+
    #
    # === Usage
    #
    #   # config/alchemy/config.yml
    #   ...
    #   require_ssl: true
    #   ...
    #
    # === Note
    #
    # You have to create a ssl certificate
    # if you want to use the ssl protection.
    #
    def ssl_required?
      !Rails.env.test? && Config.get(:require_ssl)
    end

    # Redirects current request to https.
    def enforce_ssl
      redirect_to url_for(request.params.merge(protocol: 'https'))
    end
  end
end

Version data entries

31 entries across 31 versions & 1 rubygems

Version Path
alchemy_cms-4.5.1 lib/alchemy/ssl_protection.rb
alchemy_cms-4.4.5 lib/alchemy/ssl_protection.rb
alchemy_cms-4.0.6 lib/alchemy/ssl_protection.rb
alchemy_cms-4.5.0 lib/alchemy/ssl_protection.rb
alchemy_cms-4.4.4 lib/alchemy/ssl_protection.rb
alchemy_cms-4.4.3 lib/alchemy/ssl_protection.rb
alchemy_cms-4.4.2 lib/alchemy/ssl_protection.rb
alchemy_cms-4.4.1 lib/alchemy/ssl_protection.rb
alchemy_cms-4.4.0 lib/alchemy/ssl_protection.rb
alchemy_cms-4.3.2 lib/alchemy/ssl_protection.rb
alchemy_cms-4.2.4 lib/alchemy/ssl_protection.rb
alchemy_cms-4.3.1 lib/alchemy/ssl_protection.rb
alchemy_cms-4.2.3 lib/alchemy/ssl_protection.rb
alchemy_cms-4.3.0 lib/alchemy/ssl_protection.rb
alchemy_cms-4.2.2 lib/alchemy/ssl_protection.rb
alchemy_cms-4.1.2 lib/alchemy/ssl_protection.rb
alchemy_cms-4.1.1 lib/alchemy/ssl_protection.rb
alchemy_cms-4.2.1 lib/alchemy/ssl_protection.rb
alchemy_cms-4.2.0 lib/alchemy/ssl_protection.rb
alchemy_cms-4.2.0.rc1 lib/alchemy/ssl_protection.rb