metamaps--metamaps/config/initializers/warden_hooks.rb
Devin Howard fc701cf485 rubocop
2017-10-16 18:15:47 -07:00

12 lines
399 B
Ruby

# frozen_string_literal: true
Warden::Manager.after_set_user do |user, auth, opts|
scope = opts[:scope]
auth.cookies.signed["#{scope}.id"] = user.id
auth.cookies.signed["#{scope}.expires_at"] = 30.minutes.from_now
end
Warden::Manager.before_logout do |_user, auth, opts|
scope = opts[:scope]
auth.cookies.signed["#{scope}.id"] = nil
auth.cookies.signed["#{scope}.expires_at"] = nil
end