Sha256: 3ba3fd8fabb13bad3fd2e0d2f2bb42e1d10866644f537b60674b35c1c7fac06d

Contents?: true

Size: 597 Bytes

Versions: 27

Compression:

Stored size: 597 Bytes

Contents

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

27 entries across 27 versions & 2 rubygems

Version Path
alchemy_cms-3.6.7 lib/alchemy/ssl_protection.rb
alchemy_cms-3.6.6 lib/alchemy/ssl_protection.rb
alchemy_cms-3.6.5 lib/alchemy/ssl_protection.rb
alchemy_cms-3.6.4 lib/alchemy/ssl_protection.rb
alchemy_cms-3.6.3 lib/alchemy/ssl_protection.rb
alchemy_cms-3.6.2 lib/alchemy/ssl_protection.rb
alchemy_cms-3.6.1 lib/alchemy/ssl_protection.rb
alchemy_cms-4.0.0.beta lib/alchemy/ssl_protection.rb
alchemy_cms-3.6.0 lib/alchemy/ssl_protection.rb
alchemy_cms-3.5.0 lib/alchemy/ssl_protection.rb
alchemy_cms-3.4.2 lib/alchemy/ssl_protection.rb
alchemy_cms-3.5.0.rc2 lib/alchemy/ssl_protection.rb
alchemy_cms-3.5.0.rc1 lib/alchemy/ssl_protection.rb
alchemy_cms-3.4.1 lib/alchemy/ssl_protection.rb
alchemy_cms-3.3.3 lib/alchemy/ssl_protection.rb
alchemy_cms-3.3.2 lib/alchemy/ssl_protection.rb
alchemy_cms-3.4.0 lib/alchemy/ssl_protection.rb
alchemy_cms-3.4.0.rc1 lib/alchemy/ssl_protection.rb
alchemy_cms-3.3.1 lib/alchemy/ssl_protection.rb
alchemy_cms-3.3.0 lib/alchemy/ssl_protection.rb