Module: Locomotive::ActionController::Ssl

Included in:
BaseController
Defined in:
lib/locomotive/action_controller/ssl.rb

Instance Method Summary collapse

Instance Method Details

#require_sslObject



5
6
7
8
9
10
11
12
13
14
15
# File 'lib/locomotive/action_controller/ssl.rb', line 5

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

  # only require ssl for requests for the main domain
  if !Locomotive.config.multi_sites? || Locomotive.config.multi_sites.domain == request.domain
    redirect_to protocol: 'https://'
  end

  true
end