modules.rb 1.2 KB

1234567891011121314151617181920212223242526272829
  1. require 'active_support/core_ext/object/with_options'
  2. Devise.with_options :model => true do |d|
  3. # Strategies first
  4. d.with_options :strategy => true do |s|
  5. routes = [nil, :new, :destroy]
  6. s.add_module :database_authenticatable, :controller => :sessions, :route => { :session => routes }
  7. s.add_module :token_authenticatable, :controller => :sessions, :route => { :session => routes }, :no_input => true
  8. s.add_module :rememberable, :no_input => true
  9. end
  10. # Other authentications
  11. d.add_module :omniauthable, :controller => :omniauth_callbacks, :route => :omniauth_callback
  12. # Misc after
  13. routes = [nil, :new, :edit]
  14. d.add_module :recoverable, :controller => :passwords, :route => { :password => routes }
  15. d.add_module :registerable, :controller => :registrations, :route => { :registration => (routes << :cancel) }
  16. d.add_module :validatable
  17. # The ones which can sign out after
  18. routes = [nil, :new]
  19. d.add_module :confirmable, :controller => :confirmations, :route => { :confirmation => routes }
  20. d.add_module :lockable, :controller => :unlocks, :route => { :unlock => routes }
  21. d.add_module :timeoutable
  22. # Stats for last, so we make sure the user is really signed in
  23. d.add_module :trackable
  24. end