From 25f969e33b80cdedc50d27f2bd6a6dd140ac365b Mon Sep 17 00:00:00 2001
From: Collin Brittle <cnbrittle@gmail.com>
Date: Thu, 13 Aug 2015 14:50:34 -0400
Subject: [PATCH] Force Devise to use SSL

---
 config/environments/development.rb | 5 +++++
 config/environments/production.rb  | 5 +++++
 2 files changed, 10 insertions(+)

diff --git a/config/environments/development.rb b/config/environments/development.rb
index b55e214..24f0f8b 100644
--- a/config/environments/development.rb
+++ b/config/environments/development.rb
@@ -38,4 +38,9 @@ Rails.application.configure do
 
   # Raises error for missing translations
   # config.action_view.raise_on_missing_translations = true
+
+  # Force Devise to use SSL
+  config.to_prepare { Devise::SessionsController.force_ssl }
+  config.to_prepare { Devise::RegistrationsController.force_ssl }
+  config.to_prepare { Devise::PasswordsController.force_ssl }
 end
diff --git a/config/environments/production.rb b/config/environments/production.rb
index 5c1b32e..dbbd5ef 100644
--- a/config/environments/production.rb
+++ b/config/environments/production.rb
@@ -76,4 +76,9 @@ Rails.application.configure do
 
   # Do not dump schema after migrations.
   config.active_record.dump_schema_after_migration = false
+
+  # Force Devise to use SSL
+  config.to_prepare { Devise::SessionsController.force_ssl }
+  config.to_prepare { Devise::RegistrationsController.force_ssl }
+  config.to_prepare { Devise::PasswordsController.force_ssl }
 end
-- 
GitLab