about summary refs log tree commit diff
diff options
context:
space:
mode:
authorabcang <abcang1015@gmail.com>2018-07-26 01:49:47 +0900
committerEugen Rochko <eugen@zeonfederated.com>2018-07-25 18:49:47 +0200
commit69bf116345e9ec24844c995f05b063a15972948b (patch)
treea36a13a422bbd5b623fd762054113f8820fc72a1
parentb62ec00d8783280810497171c11790f7c1474e8f (diff)
Add secure option to additional cookie (#8069)
-rw-r--r--config/initializers/devise.rb2
1 files changed, 2 insertions, 0 deletions
diff --git a/config/initializers/devise.rb b/config/initializers/devise.rb
index e0d263f16..8532c9d9a 100644
--- a/config/initializers/devise.rb
+++ b/config/initializers/devise.rb
@@ -9,6 +9,7 @@ Warden::Manager.after_set_user except: :fetch do |user, warden|
     value: session_id,
     expires: 1.year.from_now,
     httponly: true,
+    secure: (Rails.env.production? || ENV['LOCAL_HTTPS'] == 'true'),
   }
 end
 
@@ -18,6 +19,7 @@ Warden::Manager.after_fetch do |user, warden|
       value: warden.cookies.signed['_session_id'] || warden.raw_session['auth_id'],
       expires: 1.year.from_now,
       httponly: true,
+      secure: (Rails.env.production? || ENV['LOCAL_HTTPS'] == 'true'),
     }
   else
     warden.logout