2017-12-21 12:36:29 -05:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2010-03-03 05:57:23 -05:00
|
|
|
require 'active_support/core_ext/object/with_options'
|
|
|
|
|
2014-02-25 11:42:55 -05:00
|
|
|
Devise.with_options model: true do |d|
|
2010-03-03 05:57:23 -05:00
|
|
|
# Strategies first
|
2014-02-25 11:42:55 -05:00
|
|
|
d.with_options strategy: true do |s|
|
2010-07-13 04:09:55 -04:00
|
|
|
routes = [nil, :new, :destroy]
|
2014-02-25 11:42:55 -05:00
|
|
|
s.add_module :database_authenticatable, controller: :sessions, route: { session: routes }
|
|
|
|
s.add_module :rememberable, no_input: true
|
2010-03-03 05:57:23 -05:00
|
|
|
end
|
|
|
|
|
2010-07-12 12:56:27 -04:00
|
|
|
# Other authentications
|
2014-02-25 11:42:55 -05:00
|
|
|
d.add_module :omniauthable, controller: :omniauth_callbacks, route: :omniauth_callback
|
2010-07-12 12:56:27 -04:00
|
|
|
|
|
|
|
# Misc after
|
2010-07-13 04:09:55 -04:00
|
|
|
routes = [nil, :new, :edit]
|
2014-02-25 11:42:55 -05:00
|
|
|
d.add_module :recoverable, controller: :passwords, route: { password: routes }
|
|
|
|
d.add_module :registerable, controller: :registrations, route: { registration: (routes << :cancel) }
|
2010-03-03 05:57:23 -05:00
|
|
|
d.add_module :validatable
|
|
|
|
|
|
|
|
# The ones which can sign out after
|
2010-07-13 04:09:55 -04:00
|
|
|
routes = [nil, :new]
|
2014-02-25 11:42:55 -05:00
|
|
|
d.add_module :confirmable, controller: :confirmations, route: { confirmation: routes }
|
|
|
|
d.add_module :lockable, controller: :unlocks, route: { unlock: routes }
|
2010-04-03 07:11:45 -04:00
|
|
|
d.add_module :timeoutable
|
2010-03-03 05:57:23 -05:00
|
|
|
|
|
|
|
# Stats for last, so we make sure the user is really signed in
|
|
|
|
d.add_module :trackable
|
2013-12-05 03:03:32 -05:00
|
|
|
end
|