Skip to content

Instantly share code, notes, and snippets.

@jamiew
Created May 19, 2011 22:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save jamiew/981968 to your computer and use it in GitHub Desktop.
Save jamiew/981968 to your computer and use it in GitHub Desktop.
Monkeypatch Devise to support saving sessions via HTTP auth (e.g. via bookmarklets or browser addons)
# config/initializers/devise_http_rememberable.rb
# Monkeypatch Devise so HTTP authentication sets remember_user_token cookie
# ABR: Always Be Remembering
module Devise
module Strategies
class Authenticatable < Base
def remember_me?
# Devise's implementation of this is:
# valid_params? && Devise::TRUE_VALUES.include?(params_auth_hash[:remember_me])
# which only works for param authentication, not http authentication
true
end
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment