Chatwoot/config/initializers/warden_hooks.rb

12 lines
369 B
Ruby
Raw Normal View History

2019-10-20 08:47:26 +00:00
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
2019-10-20 08:47:26 +00:00
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