about summary refs log tree commit diff
path: root/config/initializers
diff options
context:
space:
mode:
authorbeatrix-bitrot <beatrix.bitrot@gmail.com>2017-07-22 01:16:53 +0000
committerbeatrix-bitrot <beatrix.bitrot@gmail.com>2017-07-22 01:16:53 +0000
commit984d2d4cb626dd3a4da707ecf1e8ad45b476d8fb (patch)
tree9a7ba46c448cca4a4a245224bf421941a33c263d /config/initializers
parent0244019ca17288802a144c84b7e0f319f1685695 (diff)
parent8d6c3cd48ae4f96752ff6b698bc7244d97aa9a27 (diff)
Merge that good fresh upstream shit
Diffstat (limited to 'config/initializers')
-rw-r--r--config/initializers/devise.rb8
1 files changed, 6 insertions, 2 deletions
diff --git a/config/initializers/devise.rb b/config/initializers/devise.rb
index bf61ea0ea..e6b0e90cb 100644
--- a/config/initializers/devise.rb
+++ b/config/initializers/devise.rb
@@ -1,8 +1,12 @@
 Warden::Manager.after_set_user except: :fetch do |user, warden|
-  SessionActivation.deactivate warden.cookies.signed['_session_id']
+  if user.session_active?(warden.cookies.signed['_session_id'] || warden.raw_session['auth_id'])
+    session_id = warden.cookies.signed['_session_id'] || warden.raw_session['auth_id']
+  else
+    session_id = user.activate_session(warden.request)
+  end
 
   warden.cookies.signed['_session_id'] = {
-    value: user.activate_session(warden.request),
+    value: session_id,
     expires: 1.year.from_now,
     httponly: true,
   }