From a0dd90a397648efafd5b2ff3383c1894ad5acac6 Mon Sep 17 00:00:00 2001 From: Matt Jankowski Date: Sun, 23 Apr 2017 20:44:05 -0400 Subject: Return force_ssl to the controller (#2380) --- app/controllers/application_controller.rb | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'app') diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index ad2be71ee..291895457 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -5,6 +5,8 @@ class ApplicationController < ActionController::Base # For APIs, you may want to use :null_session instead. protect_from_forgery with: :exception + force_ssl if: :https_enabled? + include Localized helper_method :current_account @@ -24,6 +26,10 @@ class ApplicationController < ActionController::Base private + def https_enabled? + Rails.env.production? && ENV['LOCAL_HTTPS'] == 'true' + end + def store_current_location store_location_for(:user, request.url) end -- cgit