Sha256: 5cbddf964a1c9627c2ddcf5265311647f04c7d63a6880cfb7b1f982966a221ce

Contents?: true

Size: 657 Bytes

Versions: 7

Compression:

Stored size: 657 Bytes

Contents

Janus::Manager.after_login do |user, manager, options|
  if options[:rememberable] && user.respond_to?(:remember_me!)
    user.remember_me!

    remember_cookie_name = Janus::Strategies::Rememberable.remember_cookie_name(options[:scope])
    manager.cookies[remember_cookie_name] = {
      :value => user.remember_token,
      :expires => user.class.remember_for.from_now
    }
  end
end

Janus::Manager.after_logout do |user, manager, options|
  if user.respond_to?(:forget_me!)
    user.forget_me!

    remember_cookie_name = Janus::Strategies::Rememberable.remember_cookie_name(options[:scope])
    manager.cookies.delete(remember_cookie_name)
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
janus-0.10.1 lib/janus/hooks/rememberable.rb
janus-0.10.0 lib/janus/hooks/rememberable.rb
janus-0.9.1 lib/janus/hooks/rememberable.rb
janus-0.9.0 lib/janus/hooks/rememberable.rb
janus-0.8.1 lib/janus/hooks/rememberable.rb
janus-0.8.0 lib/janus/hooks/rememberable.rb
janus-0.7.0 lib/janus/hooks/rememberable.rb