1
0
Fork 0
mirror of https://github.com/heartcombo/devise.git synced 2022-11-09 12:18:31 -05:00
heartcombo--devise/lib/devise/modules.rb

30 lines
1.2 KiB
Ruby
Raw Normal View History

require 'active_support/core_ext/object/with_options'
Devise.with_options :model => true do |d|
# Strategies first
2010-07-13 04:09:55 -04:00
d.with_options :strategy => true do |s|
routes = [nil, :new, :destroy]
s.add_module :database_authenticatable, :controller => :sessions, :route => { :session => routes }
s.add_module :token_authenticatable, :controller => :sessions, :route => { :session => routes }
s.add_module :rememberable
end
2010-07-12 12:56:27 -04:00
# Other authentications
d.add_module :encryptable
2010-07-13 04:09:55 -04:00
d.add_module :oauthable, :controller => :oauth_callbacks, :route => :oauth_callback
2010-07-12 12:56:27 -04:00
# Misc after
2010-07-13 04:09:55 -04:00
routes = [nil, :new, :edit]
d.add_module :recoverable, :controller => :passwords, :route => { :password => routes }
d.add_module :registerable, :controller => :registrations, :route => { :registration => (routes << :cancel) }
d.add_module :validatable
# The ones which can sign out after
2010-07-13 04:09:55 -04:00
routes = [nil, :new]
d.add_module :confirmable, :controller => :confirmations, :route => { :confirmation => routes }
d.add_module :lockable, :controller => :unlocks, :route => { :unlock => routes }
d.add_module :timeoutable
# Stats for last, so we make sure the user is really signed in
d.add_module :trackable
end