From: abcang Date: Wed, 25 Jul 2018 16:49:47 +0000 (+0900) Subject: Add secure option to additional cookie (#8069) X-Git-Url: https://git.xn--scling-oua.cat.family/?a=commitdiff_plain;h=69bf116345e9ec24844c995f05b063a15972948b;p=mastodon.git Add secure option to additional cookie (#8069) --- 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