devise 1.0.11 → 1.1.pre
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of devise might be problematic. Click here for more details.
- data/CHANGELOG.rdoc +6 -72
- data/Gemfile +18 -0
- data/README.rdoc +51 -46
- data/Rakefile +5 -4
- data/app/controllers/{confirmations_controller.rb → devise/confirmations_controller.rb} +2 -2
- data/app/controllers/{passwords_controller.rb → devise/passwords_controller.rb} +4 -3
- data/app/controllers/{registrations_controller.rb → devise/registrations_controller.rb} +11 -7
- data/app/controllers/{sessions_controller.rb → devise/sessions_controller.rb} +11 -8
- data/app/controllers/{unlocks_controller.rb → devise/unlocks_controller.rb} +2 -10
- data/app/models/devise/mailer.rb +55 -0
- data/app/views/{confirmations → devise/confirmations}/new.html.erb +1 -1
- data/app/views/devise/mailer/confirmation_instructions.html.erb +5 -0
- data/app/views/devise/mailer/reset_password_instructions.html.erb +8 -0
- data/app/views/devise/mailer/unlock_instructions.html.erb +7 -0
- data/app/views/{passwords → devise/passwords}/edit.html.erb +1 -1
- data/app/views/{passwords → devise/passwords}/new.html.erb +1 -1
- data/app/views/{registrations → devise/registrations}/edit.html.erb +1 -1
- data/app/views/{registrations → devise/registrations}/new.html.erb +1 -1
- data/app/views/{sessions → devise/sessions}/new.html.erb +1 -1
- data/app/views/{shared/_devise_links.erb → devise/shared/_links.erb} +0 -0
- data/app/views/{unlocks → devise/unlocks}/new.html.erb +1 -1
- data/{lib/devise → config}/locales/en.yml +7 -1
- data/lib/devise.rb +6 -29
- data/lib/devise/controllers/helpers.rb +16 -43
- data/lib/devise/controllers/internal_helpers.rb +10 -36
- data/lib/devise/controllers/scoped_views.rb +35 -0
- data/lib/devise/failure_app.rb +7 -14
- data/lib/devise/hooks/rememberable.rb +3 -6
- data/lib/devise/hooks/trackable.rb +1 -1
- data/lib/devise/mapping.rb +17 -18
- data/lib/devise/models.rb +4 -20
- data/lib/devise/models/{database_authenticatable.rb → authenticatable.rb} +16 -28
- data/lib/devise/models/confirmable.rb +25 -23
- data/lib/devise/models/http_authenticatable.rb +3 -7
- data/lib/devise/models/lockable.rb +40 -35
- data/lib/devise/models/recoverable.rb +4 -8
- data/lib/devise/models/rememberable.rb +6 -9
- data/lib/devise/models/timeoutable.rb +1 -3
- data/lib/devise/models/token_authenticatable.rb +4 -5
- data/lib/devise/models/validatable.rb +10 -1
- data/lib/devise/orm/mongo_mapper.rb +10 -23
- data/lib/devise/rails.rb +11 -9
- data/lib/devise/rails/routes.rb +113 -107
- data/lib/devise/rails/warden_compat.rb +3 -41
- data/lib/devise/schema.rb +13 -21
- data/lib/devise/strategies/{database_authenticatable.rb → authenticatable.rb} +3 -3
- data/lib/devise/strategies/http_authenticatable.rb +4 -22
- data/lib/devise/test_helpers.rb +1 -8
- data/lib/devise/version.rb +1 -1
- data/lib/generators/devise/devise_generator.rb +57 -0
- data/{generators → lib/generators}/devise/templates/migration.rb +1 -1
- data/lib/generators/devise_install/devise_install_generator.rb +25 -0
- data/{generators → lib/generators}/devise_install/templates/README +4 -8
- data/{generators → lib/generators}/devise_install/templates/devise.rb +0 -3
- data/lib/generators/devise_views/devise_views_generator.rb +11 -0
- data/test/controllers/helpers_test.rb +15 -9
- data/test/devise_test.rb +1 -6
- data/test/encryptors_test.rb +0 -3
- data/test/failure_app_test.rb +6 -1
- data/test/integration/authenticatable_test.rb +25 -85
- data/test/integration/http_authenticatable_test.rb +2 -10
- data/test/integration/lockable_test.rb +3 -22
- data/test/integration/recoverable_test.rb +1 -1
- data/test/integration/registerable_test.rb +31 -36
- data/test/integration/rememberable_test.rb +6 -24
- data/test/integration/token_authenticatable_test.rb +2 -4
- data/test/integration/trackable_test.rb +1 -1
- data/test/mailers/confirmation_instructions_test.rb +4 -10
- data/test/mailers/unlock_instructions_test.rb +1 -1
- data/test/mapping_test.rb +12 -24
- data/test/models/authenticatable_test.rb +3 -3
- data/test/models/confirmable_test.rb +29 -29
- data/test/models/http_authenticatable_test.rb +19 -0
- data/test/models/lockable_test.rb +45 -44
- data/test/models/recoverable_test.rb +7 -7
- data/test/models/rememberable_test.rb +7 -10
- data/test/models/validatable_test.rb +19 -24
- data/test/models_test.rb +2 -16
- data/test/orm/active_record.rb +3 -4
- data/test/orm/mongo_mapper.rb +2 -10
- data/test/rails_app/app/active_record/admin.rb +1 -1
- data/test/rails_app/app/active_record/user.rb +3 -3
- data/test/rails_app/app/controllers/application_controller.rb +1 -7
- data/test/rails_app/app/controllers/sessions_controller.rb +6 -0
- data/test/rails_app/app/controllers/users_controller.rb +0 -4
- data/test/rails_app/app/mongo_mapper/admin.rb +4 -7
- data/test/rails_app/app/mongo_mapper/user.rb +5 -8
- data/test/rails_app/config/application.rb +32 -0
- data/test/rails_app/config/boot.rb +7 -108
- data/test/rails_app/config/environment.rb +4 -41
- data/test/rails_app/config/environments/development.rb +15 -13
- data/test/rails_app/config/environments/production.rb +25 -20
- data/test/rails_app/config/environments/test.rb +23 -22
- data/test/rails_app/config/initializers/backtrace_silencers.rb +7 -0
- data/test/rails_app/config/initializers/cookie_verification_secret.rb +7 -0
- data/test/rails_app/config/initializers/devise.rb +0 -3
- data/test/rails_app/config/initializers/session_store.rb +2 -2
- data/test/rails_app/config/routes.rb +17 -21
- data/test/routes_test.rb +30 -47
- data/test/support/{assertions_helper.rb → assertions.rb} +0 -15
- data/test/support/{tests_helper.rb → helpers.rb} +16 -3
- data/test/support/{integration_tests_helper.rb → integration.rb} +8 -4
- data/test/support/webrat/integrations/rails.rb +31 -0
- data/test/test_helper.rb +8 -7
- data/test/test_helpers_test.rb +9 -9
- metadata +53 -128
- data/app/models/devise_mailer.rb +0 -68
- data/app/views/devise_mailer/confirmation_instructions.html.erb +0 -5
- data/app/views/devise_mailer/reset_password_instructions.html.erb +0 -8
- data/app/views/devise_mailer/unlock_instructions.html.erb +0 -7
- data/generators/devise/USAGE +0 -5
- data/generators/devise/devise_generator.rb +0 -15
- data/generators/devise/lib/route_devise.rb +0 -32
- data/generators/devise/templates/model.rb +0 -9
- data/generators/devise_install/USAGE +0 -3
- data/generators/devise_install/devise_install_generator.rb +0 -15
- data/generators/devise_views/USAGE +0 -3
- data/generators/devise_views/devise_views_generator.rb +0 -21
- data/rails/init.rb +0 -2
- data/test/integration/rack_middleware_test.rb +0 -47
- data/test/rails_app/config/initializers/new_rails_defaults.rb +0 -24
@@ -14,11 +14,7 @@ module Devise
|
|
14
14
|
# # creates a new token and send it with instructions about how to reset the password
|
15
15
|
# User.find(1).send_reset_password_instructions
|
16
16
|
module Recoverable
|
17
|
-
|
18
|
-
base.class_eval do
|
19
|
-
extend ClassMethods
|
20
|
-
end
|
21
|
-
end
|
17
|
+
extend ActiveSupport::Concern
|
22
18
|
|
23
19
|
# Update password saving the record and clearing token. Returns true if
|
24
20
|
# the passwords are valid and the record was saved, false otherwise.
|
@@ -32,7 +28,7 @@ module Devise
|
|
32
28
|
# Resets reset password token and send reset password instructions by email
|
33
29
|
def send_reset_password_instructions
|
34
30
|
generate_reset_password_token!
|
35
|
-
::
|
31
|
+
::Devise::Mailer.reset_password_instructions(self).deliver
|
36
32
|
end
|
37
33
|
|
38
34
|
protected
|
@@ -45,7 +41,7 @@ module Devise
|
|
45
41
|
# Resets the reset password token with and save the record without
|
46
42
|
# validating
|
47
43
|
def generate_reset_password_token!
|
48
|
-
generate_reset_password_token && save(false)
|
44
|
+
generate_reset_password_token && save(:validate => false)
|
49
45
|
end
|
50
46
|
|
51
47
|
# Removes reset_password token
|
@@ -69,7 +65,7 @@ module Devise
|
|
69
65
|
# try saving the record. If not user is found, returns a new user
|
70
66
|
# containing an error in reset_password_token attribute.
|
71
67
|
# Attributes must contain reset_password_token, password and confirmation
|
72
|
-
def
|
68
|
+
def reset_password!(attributes={})
|
73
69
|
recoverable = find_or_initialize_with_error_by(:reset_password_token, attributes[:reset_password_token])
|
74
70
|
recoverable.reset_password!(attributes[:password], attributes[:password_confirmation]) unless recoverable.new_record?
|
75
71
|
recoverable
|
@@ -30,21 +30,18 @@ module Devise
|
|
30
30
|
# # lookup the user based on the incoming cookie information
|
31
31
|
# User.serialize_from_cookie(cookie_string)
|
32
32
|
module Rememberable
|
33
|
+
extend ActiveSupport::Concern
|
33
34
|
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
# Remember me option available in after_authentication hook.
|
39
|
-
attr_accessor :remember_me
|
40
|
-
end
|
35
|
+
included do
|
36
|
+
# Remember me option available in after_authentication hook.
|
37
|
+
attr_accessor :remember_me
|
41
38
|
end
|
42
39
|
|
43
40
|
# Generate a new remember token and save the record without validations.
|
44
41
|
def remember_me!
|
45
42
|
self.remember_token = Devise.friendly_token
|
46
43
|
self.remember_created_at = Time.now.utc
|
47
|
-
save(false)
|
44
|
+
save(:validate => false)
|
48
45
|
end
|
49
46
|
|
50
47
|
# Removes the remember token only if it exists, and save the record
|
@@ -53,7 +50,7 @@ module Devise
|
|
53
50
|
if remember_token
|
54
51
|
self.remember_token = nil
|
55
52
|
self.remember_created_at = nil
|
56
|
-
save(false)
|
53
|
+
save(:validate => false)
|
57
54
|
end
|
58
55
|
end
|
59
56
|
|
@@ -11,9 +11,7 @@ module Devise
|
|
11
11
|
#
|
12
12
|
# timeout_in: the time you want to timeout the user session without activity.
|
13
13
|
module Timeoutable
|
14
|
-
|
15
|
-
base.extend ClassMethods
|
16
|
-
end
|
14
|
+
extend ActiveSupport::Concern
|
17
15
|
|
18
16
|
# Checks whether the user session has expired based on configured time.
|
19
17
|
def timedout?(last_access)
|
@@ -18,11 +18,10 @@ module Devise
|
|
18
18
|
# User.find(1).valid_authentication_token?('rI1t6PKQ8yP7VetgwdybB') # returns true/false
|
19
19
|
#
|
20
20
|
module TokenAuthenticatable
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
end
|
21
|
+
extend ActiveSupport::Concern
|
22
|
+
|
23
|
+
included do
|
24
|
+
before_save :ensure_authentication_token
|
26
25
|
end
|
27
26
|
|
28
27
|
# Generate new authentication token (a.k.a. "single access token").
|
@@ -15,7 +15,7 @@ module Devise
|
|
15
15
|
|
16
16
|
base.class_eval do
|
17
17
|
validates_presence_of :email
|
18
|
-
validates_uniqueness_of :email, :scope => authentication_keys[1..-1], :
|
18
|
+
validates_uniqueness_of :email, :scope => authentication_keys[1..-1], :allow_blank => true
|
19
19
|
validates_format_of :email, :with => EMAIL_REGEX, :allow_blank => true
|
20
20
|
|
21
21
|
with_options :if => :password_required? do |v|
|
@@ -34,6 +34,15 @@ module Devise
|
|
34
34
|
"to the following methods: #{unavailable_validations.to_sentence}."
|
35
35
|
end
|
36
36
|
end
|
37
|
+
|
38
|
+
protected
|
39
|
+
|
40
|
+
# Checks whether a password is needed or not. For validations only.
|
41
|
+
# Passwords are always required if it's a new record, or if the password
|
42
|
+
# or confirmation are being set somewhere.
|
43
|
+
def password_required?
|
44
|
+
new_record? || !password.nil? || !password_confirmation.nil?
|
45
|
+
end
|
37
46
|
end
|
38
47
|
end
|
39
48
|
end
|
@@ -1,19 +1,8 @@
|
|
1
1
|
module Devise
|
2
2
|
module Orm
|
3
3
|
module MongoMapper
|
4
|
-
module InstanceMethods
|
5
|
-
def save(options={})
|
6
|
-
if options == false
|
7
|
-
super(:validate => false)
|
8
|
-
else
|
9
|
-
super
|
10
|
-
end
|
11
|
-
end
|
12
|
-
end
|
13
|
-
|
14
4
|
def self.included_modules_hook(klass)
|
15
|
-
klass.send :extend,
|
16
|
-
klass.send :include, InstanceMethods
|
5
|
+
klass.send :extend, self
|
17
6
|
yield
|
18
7
|
|
19
8
|
klass.devise_modules.each do |mod|
|
@@ -22,11 +11,14 @@ module Devise
|
|
22
11
|
end
|
23
12
|
|
24
13
|
def find(*args)
|
14
|
+
options = args.extract_options!
|
25
15
|
case args.first
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
16
|
+
when :first
|
17
|
+
first(options)
|
18
|
+
when :all
|
19
|
+
all(options)
|
20
|
+
else
|
21
|
+
super
|
30
22
|
end
|
31
23
|
end
|
32
24
|
|
@@ -43,10 +35,5 @@ module Devise
|
|
43
35
|
end
|
44
36
|
end
|
45
37
|
|
46
|
-
|
47
|
-
|
48
|
-
MongoMapper::Plugins::EmbeddedDocument::ClassMethods.send(:include, Devise::Models)
|
49
|
-
else
|
50
|
-
MongoMapper::Document::ClassMethods.send(:include, Devise::Models)
|
51
|
-
MongoMapper::EmbeddedDocument::ClassMethods.send(:include, Devise::Models)
|
52
|
-
end
|
38
|
+
MongoMapper::Document::ClassMethods.send(:include, Devise::Models)
|
39
|
+
MongoMapper::EmbeddedDocument::ClassMethods.send(:include, Devise::Models)
|
data/lib/devise/rails.rb
CHANGED
@@ -1,14 +1,16 @@
|
|
1
1
|
require 'devise/rails/routes'
|
2
2
|
require 'devise/rails/warden_compat'
|
3
3
|
|
4
|
-
|
5
|
-
|
4
|
+
module Devise
|
5
|
+
class Engine < ::Rails::Engine
|
6
|
+
engine_name :devise
|
6
7
|
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
Devise.configure_warden(config)
|
11
|
-
end
|
8
|
+
config.middleware.use Warden::Manager do |config|
|
9
|
+
Devise.configure_warden(config)
|
10
|
+
end
|
12
11
|
|
13
|
-
|
14
|
-
|
12
|
+
config.after_initialize do
|
13
|
+
require "devise/orm/#{Devise.orm}"
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
data/lib/devise/rails/routes.rb
CHANGED
@@ -1,11 +1,10 @@
|
|
1
|
-
module
|
1
|
+
module ActionDispatch::Routing
|
2
2
|
class RouteSet #:nodoc:
|
3
|
-
|
4
3
|
# Ensure Devise modules are included only after loading routes, because we
|
5
4
|
# need devise_for mappings already declared to create magic filters and
|
6
5
|
# helpers.
|
7
|
-
def
|
8
|
-
|
6
|
+
def finalize_with_devise!
|
7
|
+
finalize_without_devise!
|
9
8
|
return if Devise.mappings.empty?
|
10
9
|
|
11
10
|
ActionController::Base.send :include, Devise::Controllers::Helpers
|
@@ -13,121 +12,128 @@ module ActionController::Routing
|
|
13
12
|
|
14
13
|
ActionView::Base.send :include, Devise::Controllers::UrlHelpers
|
15
14
|
end
|
16
|
-
alias_method_chain :
|
15
|
+
alias_method_chain :finalize!, :devise
|
16
|
+
end
|
17
17
|
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
18
|
+
class Mapper
|
19
|
+
# Includes devise_for method for routes. This method is responsible to
|
20
|
+
# generate all needed routes for devise, based on what modules you have
|
21
|
+
# defined in your model.
|
22
|
+
# Examples: Let's say you have an User model configured to use
|
23
|
+
# authenticatable, confirmable and recoverable modules. After creating this
|
24
|
+
# inside your routes:
|
25
|
+
#
|
26
|
+
# devise_for :users
|
27
|
+
#
|
28
|
+
# this method is going to look inside your User model and create the
|
29
|
+
# needed routes:
|
30
|
+
#
|
31
|
+
# # Session routes for Authenticatable (default)
|
32
|
+
# new_user_session GET /users/sign_in {:controller=>"sessions", :action=>"new"}
|
33
|
+
# user_session POST /users/sign_in {:controller=>"sessions", :action=>"create"}
|
34
|
+
# destroy_user_session GET /users/sign_out {:controller=>"sessions", :action=>"destroy"}
|
35
|
+
#
|
36
|
+
# # Password routes for Recoverable, if User model has :recoverable configured
|
37
|
+
# new_user_password GET /users/password/new(.:format) {:controller=>"passwords", :action=>"new"}
|
38
|
+
# edit_user_password GET /users/password/edit(.:format) {:controller=>"passwords", :action=>"edit"}
|
39
|
+
# user_password PUT /users/password(.:format) {:controller=>"passwords", :action=>"update"}
|
40
|
+
# POST /users/password(.:format) {:controller=>"passwords", :action=>"create"}
|
41
|
+
#
|
42
|
+
# # Confirmation routes for Confirmable, if User model has :confirmable configured
|
43
|
+
# new_user_confirmation GET /users/confirmation/new(.:format) {:controller=>"confirmations", :action=>"new"}
|
44
|
+
# user_confirmation GET /users/confirmation(.:format) {:controller=>"confirmations", :action=>"show"}
|
45
|
+
# POST /users/confirmation(.:format) {:controller=>"confirmations", :action=>"create"}
|
46
|
+
#
|
47
|
+
# You can configure your routes with some options:
|
48
|
+
#
|
49
|
+
# * :class_name => setup a different class to be looked up by devise,
|
50
|
+
# if it cannot be correctly find by the route name.
|
51
|
+
#
|
52
|
+
# devise_for :users, :class_name => 'Account'
|
53
|
+
#
|
54
|
+
# * :as => allows you to setup path name that will be used, as rails routes does.
|
55
|
+
# The following route configuration would setup your route as /accounts instead of /users:
|
56
|
+
#
|
57
|
+
# devise_for :users, :as => 'accounts'
|
58
|
+
#
|
59
|
+
# * :scope => setup the scope name. This is used as the instance variable name in controller,
|
60
|
+
# as the name in routes and the scope given to warden. Defaults to the singular of the given name:
|
61
|
+
#
|
62
|
+
# devise_for :users, :scope => :account
|
63
|
+
#
|
64
|
+
# * :path_names => configure different path names to overwrite defaults :sign_in, :sign_out, :sign_up,
|
65
|
+
# :password, :confirmation, :unlock.
|
66
|
+
#
|
67
|
+
# devise_for :users, :path_names => { :sign_in => 'login', :sign_out => 'logout', :password => 'secret', :confirmation => 'verification' }
|
68
|
+
#
|
69
|
+
# * :path_prefix => the path prefix to be used in all routes.
|
70
|
+
#
|
71
|
+
# devise_for :users, :path_prefix => "/:locale"
|
72
|
+
#
|
73
|
+
# If you are using a dynamic prefix, like :locale above, you need to configure default_url_options through Devise.
|
74
|
+
# You can do that in config/initializers/devise.rb or setting a Devise.default_url_options:
|
75
|
+
#
|
76
|
+
# Devise.default_url_options do
|
77
|
+
# { :locale => I18n.locale }
|
78
|
+
# end
|
79
|
+
#
|
80
|
+
# * :controllers => the controller which should be used. All routes by default points to Devise controllers.
|
81
|
+
# However, if you want them to point to custom controller, you should do:
|
82
|
+
#
|
83
|
+
# devise_for :users, :controllers => { :sessions => "users/sessions" }
|
84
|
+
#
|
85
|
+
def devise_for(*resources)
|
86
|
+
options = resources.extract_options!
|
87
|
+
resources.map!(&:to_sym)
|
87
88
|
|
88
|
-
|
89
|
-
|
90
|
-
mapping = Devise::Mapping.new(resource, options.dup)
|
91
|
-
Devise.default_scope ||= mapping.name
|
92
|
-
Devise.mappings[mapping.name] = mapping
|
89
|
+
controllers = Hash.new { |h,k| h[k] = "devise/#{k}" }
|
90
|
+
controllers.merge!(options.delete(:controllers) || {})
|
93
91
|
|
94
|
-
|
92
|
+
resources.each do |resource|
|
93
|
+
mapping = Devise::Mapping.new(resource, options.dup)
|
95
94
|
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
95
|
+
Devise.default_scope ||= mapping.name
|
96
|
+
Devise.mappings[mapping.name] = mapping
|
97
|
+
|
98
|
+
mapping.for.each do |mod|
|
99
|
+
send(mod, mapping, controllers) if self.respond_to?(mod, true)
|
101
100
|
end
|
102
101
|
end
|
102
|
+
end
|
103
103
|
|
104
|
-
|
104
|
+
protected
|
105
105
|
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
destroy_options.merge! :conditions => { :method => mapping.sign_out_via } unless mapping.sign_out_via == :any
|
112
|
-
session.send(:"destroy_#{mapping.name}_session", mapping.path_names[:sign_out], destroy_options)
|
113
|
-
end
|
106
|
+
def authenticatable(mapping, controllers)
|
107
|
+
scope mapping.raw_path do
|
108
|
+
get mapping.path_names[:sign_in], :to => "#{controllers[:sessions]}#new", :as => :"new_#{mapping.name}_session"
|
109
|
+
post mapping.path_names[:sign_in], :to => "#{controllers[:sessions]}#create", :as => :"#{mapping.name}_session"
|
110
|
+
get mapping.path_names[:sign_out], :to => "#{controllers[:sessions]}#destroy", :as => :"destroy_#{mapping.name}_session"
|
114
111
|
end
|
115
|
-
|
116
|
-
|
117
|
-
|
112
|
+
end
|
113
|
+
|
114
|
+
def recoverable(mapping, controllers)
|
115
|
+
scope mapping.raw_path, :name_prefix => mapping.name do
|
116
|
+
resource :password, :only => [:new, :create, :edit, :update], :as => mapping.path_names[:password], :controller => controllers[:passwords]
|
118
117
|
end
|
119
|
-
|
120
|
-
|
121
|
-
|
118
|
+
end
|
119
|
+
|
120
|
+
def confirmable(mapping, controllers)
|
121
|
+
scope mapping.raw_path, :name_prefix => mapping.name do
|
122
|
+
resource :confirmation, :only => [:new, :create, :show], :as => mapping.path_names[:confirmation], :controller => controllers[:confirmations]
|
122
123
|
end
|
123
|
-
|
124
|
-
|
125
|
-
|
124
|
+
end
|
125
|
+
|
126
|
+
def lockable(mapping, controllers)
|
127
|
+
scope mapping.raw_path, :name_prefix => mapping.name do
|
128
|
+
resource :unlock, :only => [:new, :create, :show], :as => mapping.path_names[:unlock], :controller => controllers[:unlocks]
|
126
129
|
end
|
130
|
+
end
|
127
131
|
|
128
|
-
|
129
|
-
|
132
|
+
def registerable(mapping, controllers)
|
133
|
+
scope :name_prefix => mapping.name do
|
134
|
+
resource :registration, :only => [:new, :create, :edit, :update, :destroy], :as => mapping.raw_path[1..-1],
|
135
|
+
:path_names => { :new => mapping.path_names[:sign_up] }, :controller => controllers[:registrations]
|
130
136
|
end
|
131
|
-
|
137
|
+
end
|
132
138
|
end
|
133
|
-
end
|
139
|
+
end
|