Sha256: 279e7ab35fb3ae618ac5b1fd86316c88054b277b76bcd1f5ea8bd4094984536a

Contents?: true

Size: 690 Bytes

Versions: 8

Compression:

Stored size: 690 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

    deprecate :enforce_ssl, deprecator: Alchemy::Deprecation
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
alchemy_cms-4.6.7 lib/alchemy/ssl_protection.rb
alchemy_cms-4.6.6 lib/alchemy/ssl_protection.rb
alchemy_cms-4.6.5 lib/alchemy/ssl_protection.rb
alchemy_cms-4.6.4 lib/alchemy/ssl_protection.rb
alchemy_cms-4.6.3 lib/alchemy/ssl_protection.rb
alchemy_cms-4.6.2 lib/alchemy/ssl_protection.rb
alchemy_cms-4.6.1 lib/alchemy/ssl_protection.rb
alchemy_cms-4.6.0 lib/alchemy/ssl_protection.rb