devise 1.1.rc2 → 1.1.0

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.

Files changed (77) hide show
  1. data/CHANGELOG.rdoc +22 -2
  2. data/Gemfile +7 -13
  3. data/Gemfile.lock +118 -0
  4. data/README.rdoc +15 -13
  5. data/app/controllers/devise/unlocks_controller.rb +0 -7
  6. data/app/mailers/devise/mailer.rb +7 -4
  7. data/app/views/devise/confirmations/new.html.erb +1 -1
  8. data/app/views/devise/passwords/new.html.erb +1 -1
  9. data/app/views/devise/unlocks/new.html.erb +1 -1
  10. data/lib/devise.rb +27 -9
  11. data/lib/devise/controllers/helpers.rb +19 -5
  12. data/lib/devise/controllers/internal_helpers.rb +2 -8
  13. data/lib/devise/encryptors/base.rb +1 -1
  14. data/lib/devise/encryptors/bcrypt.rb +2 -2
  15. data/lib/devise/failure_app.rb +6 -2
  16. data/lib/devise/hooks/rememberable.rb +9 -1
  17. data/lib/devise/mapping.rb +15 -50
  18. data/lib/devise/models/authenticatable.rb +8 -0
  19. data/lib/devise/models/confirmable.rb +10 -6
  20. data/lib/devise/models/database_authenticatable.rb +9 -1
  21. data/lib/devise/models/recoverable.rb +6 -1
  22. data/lib/devise/models/rememberable.rb +36 -7
  23. data/lib/devise/models/token_authenticatable.rb +5 -5
  24. data/lib/devise/models/validatable.rb +1 -1
  25. data/lib/devise/path_checker.rb +7 -2
  26. data/lib/devise/rails.rb +6 -1
  27. data/lib/devise/rails/routes.rb +137 -50
  28. data/lib/devise/rails/warden_compat.rb +16 -2
  29. data/lib/devise/strategies/authenticatable.rb +12 -0
  30. data/lib/devise/strategies/base.rb +0 -18
  31. data/lib/devise/strategies/rememberable.rb +9 -1
  32. data/lib/devise/test_helpers.rb +2 -0
  33. data/lib/devise/version.rb +1 -1
  34. data/lib/generators/active_record/devise_generator.rb +28 -0
  35. data/lib/generators/{devise/devise → active_record}/templates/migration.rb +4 -0
  36. data/lib/generators/devise/devise_generator.rb +17 -0
  37. data/lib/generators/devise/{install/install_generator.rb → install_generator.rb} +1 -1
  38. data/lib/generators/devise/orm_helpers.rb +23 -0
  39. data/lib/generators/devise/{install/templates → templates}/README +0 -0
  40. data/lib/generators/devise/{install/templates → templates}/devise.rb +20 -13
  41. data/lib/generators/devise/{views/views_generator.rb → views_generator.rb} +2 -2
  42. data/lib/generators/mongoid/devise_generator.rb +17 -0
  43. data/test/controllers/helpers_test.rb +9 -0
  44. data/test/controllers/internal_helpers_test.rb +7 -16
  45. data/test/controllers/url_helpers_test.rb +11 -0
  46. data/test/encryptors_test.rb +1 -1
  47. data/test/failure_app_test.rb +18 -5
  48. data/test/integration/authenticatable_test.rb +76 -11
  49. data/test/integration/confirmable_test.rb +16 -9
  50. data/test/integration/lockable_test.rb +11 -13
  51. data/test/integration/registerable_test.rb +4 -4
  52. data/test/integration/rememberable_test.rb +54 -1
  53. data/test/mapping_test.rb +10 -45
  54. data/test/models/confirmable_test.rb +1 -1
  55. data/test/models/rememberable_test.rb +108 -0
  56. data/test/models/validatable_test.rb +2 -4
  57. data/test/models_test.rb +4 -4
  58. data/test/rails_app/app/active_record/admin.rb +1 -1
  59. data/test/rails_app/app/controllers/publisher/registrations_controller.rb +2 -0
  60. data/test/rails_app/app/controllers/publisher/sessions_controller.rb +2 -0
  61. data/test/rails_app/app/controllers/users_controller.rb +5 -1
  62. data/test/rails_app/app/mongoid/admin.rb +1 -1
  63. data/test/rails_app/config/application.rb +2 -2
  64. data/test/rails_app/config/environments/test.rb +2 -0
  65. data/test/rails_app/config/initializers/devise.rb +95 -34
  66. data/test/rails_app/config/routes.rb +32 -14
  67. data/test/routes_test.rb +34 -2
  68. data/test/support/integration.rb +22 -6
  69. data/test/test_helpers_test.rb +16 -2
  70. metadata +24 -27
  71. data/lib/devise/orm/data_mapper.rb +0 -97
  72. data/lib/generators/devise/devise/devise_generator.rb +0 -86
  73. data/lib/generators/devise_generator.rb +0 -2
  74. data/test/orm/data_mapper.rb +0 -10
  75. data/test/rails_app/app/data_mapper/admin.rb +0 -12
  76. data/test/rails_app/app/data_mapper/shim.rb +0 -2
  77. data/test/rails_app/app/data_mapper/user.rb +0 -23
@@ -133,7 +133,7 @@ class ConfirmableTest < ActiveSupport::TestCase
133
133
  user.instance_eval { def confirmation_required?; false end }
134
134
  user.save
135
135
  user.send_confirmation_instructions
136
- assert_not_nil user.confirmation_token
136
+ assert_not_nil user.reload.confirmation_token
137
137
  end
138
138
 
139
139
  test 'should not resend email instructions if the user change his email' do
@@ -107,4 +107,112 @@ class RememberableTest < ActiveSupport::TestCase
107
107
  assert_not user.remember_expired?
108
108
  end
109
109
  end
110
+
111
+ test 'if extend_remember_period is false, remember_me! should generate a new timestamp if expired' do
112
+ swap Devise, :remember_for => 5.minutes do
113
+ user = create_user
114
+ user.remember_me!(false)
115
+ assert user.remember_created_at
116
+
117
+ user.remember_created_at = old = 10.minutes.ago
118
+ user.save
119
+
120
+ user.remember_me!(false)
121
+ assert_not_equal old.to_i, user.remember_created_at.to_i
122
+ end
123
+ end
124
+
125
+ test 'if extend_remember_period is false, remember_me! should not generate a new timestamp' do
126
+ swap Devise, :remember_for => 1.year do
127
+ user = create_user
128
+ user.remember_me!(false)
129
+ assert user.remember_created_at
130
+
131
+ user.remember_created_at = old = 10.minutes.ago.utc
132
+ user.save
133
+
134
+ user.remember_me!(false)
135
+ assert_equal old.to_i, user.remember_created_at.to_i
136
+ end
137
+ end
138
+
139
+ test 'if extend_remember_period is true, remember_me! should always generate a new timestamp' do
140
+ swap Devise, :remember_for => 1.year do
141
+ user = create_user
142
+ user.remember_me!(true)
143
+ assert user.remember_created_at
144
+
145
+ user.remember_created_at = old = 10.minutes.ago
146
+ user.save
147
+
148
+ user.remember_me!(true)
149
+ assert_not_equal old, user.remember_created_at
150
+ end
151
+ end
152
+
153
+ test 'if remember_across_browsers is true, remember_me! should create a new token if no token exists' do
154
+ swap Devise, :remember_across_browsers => true, :remember_for => 1.year do
155
+ user = create_user
156
+ assert_equal nil, user.remember_token
157
+ user.remember_me!
158
+ assert_not_equal nil, user.remember_token
159
+ end
160
+ end
161
+
162
+ test 'if remember_across_browsers is true, remember_me! should create a new token if a token exists but has expired' do
163
+ swap Devise, :remember_across_browsers => true, :remember_for => 1.day do
164
+ user = create_user
165
+ user.remember_me!
166
+ user.remember_created_at = 2.days.ago
167
+ user.save
168
+ token = user.remember_token
169
+ user.remember_me!
170
+ assert_not_equal token, user.remember_token
171
+ end
172
+ end
173
+
174
+ test 'if remember_across_browsers is true, remember_me! should not create a new token if a token exists and has not expired' do
175
+ swap Devise, :remember_across_browsers => true, :remember_for => 2.days do
176
+ user = create_user
177
+ user.remember_me!
178
+ user.remember_created_at = 1.day.ago
179
+ user.save
180
+ token = user.remember_token
181
+ user.remember_me!
182
+ assert_equal token, user.remember_token
183
+ end
184
+ end
185
+
186
+ test 'if remember_across_browsers is false, remember_me! should create a new token if no token exists' do
187
+ swap Devise, :remember_across_browsers => false do
188
+ user = create_user
189
+ assert_equal nil, user.remember_token
190
+ user.remember_me!
191
+ assert_not_equal nil, user.remember_token
192
+ end
193
+ end
194
+
195
+ test 'if remember_across_browsers is false, remember_me! should create a new token if a token exists but has expired' do
196
+ swap Devise, :remember_across_browsers => false, :remember_for => 1.day do
197
+ user = create_user
198
+ user.remember_me!
199
+ user.remember_created_at = 2.days.ago
200
+ user.save
201
+ token = user.remember_token
202
+ user.remember_me!
203
+ assert_not_equal token, user.remember_token
204
+ end
205
+ end
206
+
207
+ test 'if remember_across_browsers is false, remember_me! should create a new token if a token exists and has not expired' do
208
+ swap Devise, :remember_across_browsers => false, :remember_for => 2.days do
209
+ user = create_user
210
+ user.remember_me!
211
+ user.remember_created_at = 1.day.ago
212
+ user.save
213
+ token = user.remember_token
214
+ user.remember_me!
215
+ assert_not_equal token, user.remember_token
216
+ end
217
+ end
110
218
  end
@@ -1,8 +1,6 @@
1
1
  require 'test_helper'
2
2
 
3
3
  class ValidatableTest < ActiveSupport::TestCase
4
- extend Devise::TestSilencer if [:mongoid, :data_mapper].include?(DEVISE_ORM)
5
-
6
4
  test 'should require email to be set' do
7
5
  user = new_user(:email => nil)
8
6
  assert user.invalid?
@@ -15,11 +13,11 @@ class ValidatableTest < ActiveSupport::TestCase
15
13
 
16
14
  user = new_user(:email => '')
17
15
  assert user.invalid?
18
- assert_not_equal 'has already been taken', user.errors[:email].join
16
+ assert_no_match(/taken/, user.errors[:email].join)
19
17
 
20
18
  user.email = existing_user.email
21
19
  assert user.invalid?
22
- assert_equal 'has already been taken', user.errors[:email].join
20
+ assert_match(/taken/, user.errors[:email].join)
23
21
  end
24
22
 
25
23
  test 'should require correct email format, allowing blank' do
@@ -26,16 +26,16 @@ class ActiveRecordTest < ActiveSupport::TestCase
26
26
  end
27
27
 
28
28
  test 'can cherry pick modules' do
29
- assert_include_modules Admin, :database_authenticatable, :registerable, :timeoutable, :recoverable
29
+ assert_include_modules Admin, :database_authenticatable, :registerable, :timeoutable, :recoverable, :lockable
30
30
  end
31
31
 
32
32
  test 'chosen modules are inheritable' do
33
- assert_include_modules Inheritable, :database_authenticatable, :registerable, :timeoutable, :recoverable
33
+ assert_include_modules Inheritable, :database_authenticatable, :registerable, :timeoutable, :recoverable, :lockable
34
34
  end
35
35
 
36
36
  test 'order of module inclusion' do
37
- correct_module_order = [:database_authenticatable, :recoverable, :registerable, :timeoutable]
38
- incorrect_module_order = [:database_authenticatable, :timeoutable, :registerable, :recoverable]
37
+ correct_module_order = [:database_authenticatable, :recoverable, :registerable, :lockable, :timeoutable]
38
+ incorrect_module_order = [:database_authenticatable, :timeoutable, :registerable, :recoverable, :lockable]
39
39
 
40
40
  assert_include_modules Admin, *incorrect_module_order
41
41
 
@@ -1,3 +1,3 @@
1
1
  class Admin < ActiveRecord::Base
2
- devise :database_authenticatable, :registerable, :timeoutable, :recoverable
2
+ devise :database_authenticatable, :registerable, :timeoutable, :recoverable, :lockable, :unlock_strategy => :time
3
3
  end
@@ -0,0 +1,2 @@
1
+ class Publisher::RegistrationsController < ApplicationController
2
+ end
@@ -0,0 +1,2 @@
1
+ class Publisher::SessionsController < ApplicationController
2
+ end
@@ -1,5 +1,5 @@
1
1
  class UsersController < ApplicationController
2
- before_filter :authenticate_user!
2
+ before_filter :authenticate_user!, :except => :accept
3
3
  respond_to :html, :xml
4
4
 
5
5
  def index
@@ -7,6 +7,10 @@ class UsersController < ApplicationController
7
7
  respond_with(current_user)
8
8
  end
9
9
 
10
+ def accept
11
+ @current_user = current_user
12
+ end
13
+
10
14
  def expire
11
15
  user_session['last_request_at'] = 31.minutes.ago.utc
12
16
  render :text => 'User will be expired on next request'
@@ -2,5 +2,5 @@ class Admin
2
2
  include Mongoid::Document
3
3
  include Shim
4
4
 
5
- devise :database_authenticatable, :timeoutable, :registerable, :recoverable
5
+ devise :database_authenticatable, :timeoutable, :registerable, :recoverable, :lockable, :unlock_strategy => :time
6
6
  end
@@ -17,8 +17,8 @@ require "devise"
17
17
  module RailsApp
18
18
  class Application < Rails::Application
19
19
  # Add additional load paths for your own custom dirs
20
- config.load_paths.reject!{ |p| p =~ /\/app\/(\w+)$/ && !%w(controllers helpers views).include?($1) }
21
- config.load_paths += [ "#{config.root}/app/#{DEVISE_ORM}" ]
20
+ config.autoload_paths.reject!{ |p| p =~ /\/app\/(\w+)$/ && !%w(controllers helpers views).include?($1) }
21
+ config.autoload_paths += [ "#{config.root}/app/#{DEVISE_ORM}" ]
22
22
 
23
23
  # Configure generators values. Many other options are available, be sure to check the documentation.
24
24
  # config.generators do |g|
@@ -28,4 +28,6 @@ RailsApp::Application.configure do
28
28
  # config.active_record.schema_format = :sql
29
29
 
30
30
  config.action_dispatch.show_exceptions = false
31
+
32
+ config.active_support.deprecation = :stderr
31
33
  end
@@ -1,20 +1,20 @@
1
1
  # Use this hook to configure devise mailer, warden hooks and so forth. The first
2
2
  # four configuration values can also be set straight in your models.
3
3
  Devise.setup do |config|
4
- # Invoke `rake secret` and use the printed value to setup a pepper to generate
5
- # the encrypted password. By default no pepper is used.
6
- # config.pepper = "rake secret output"
4
+ # ==> Mailer Configuration
5
+ # Configure the e-mail address which will be shown in DeviseMailer.
6
+ config.mailer_sender = "please-change-me@config-initializers-devise.com"
7
7
 
8
- # Configure how many times you want the password re-encrypted. Default is 10.
9
- # config.stretches = 10
8
+ # Configure the class responsible to send e-mails.
9
+ # config.mailer = "Devise::Mailer"
10
10
 
11
- # Define which will be the encryption algorithm. Supported algorithms are :sha1
12
- # (default) and :sha512. Devise also supports encryptors from others authentication
13
- # frameworks as :clearance_sha1, :authlogic_sha512 (then you should set stretches
14
- # above to 20 for default behavior) and :restful_authentication_sha1 (then you
15
- # should set stretches to 10, and copy REST_AUTH_SITE_KEY to pepper)
16
- # config.encryptor = :sha1
11
+ # ==> ORM configuration
12
+ # Load and configure the ORM. Supports :active_record (default) and
13
+ # :mongoid (bson_ext recommended) by default. Other ORMs may be
14
+ # available as additional gems.
15
+ require "devise/orm/#{DEVISE_ORM}"
17
16
 
17
+ # ==> Configuration for any authentication mechanism
18
18
  # Configure which keys are used when authenticating an user. By default is
19
19
  # just :email. You can configure it to use [:username, :subdomain], so for
20
20
  # authenticating an user, both parameters are required. Remember that those
@@ -22,40 +22,108 @@ Devise.setup do |config|
22
22
  # session. If you need permissions, you should implement that in a before filter.
23
23
  # config.authentication_keys = [ :email ]
24
24
 
25
- # The time you want give to your user to confirm his account. During this time
25
+ # Tell if authentication through request.params is enabled. True by default.
26
+ # config.params_authenticatable = true
27
+
28
+ # Tell if authentication through HTTP Basic Auth is enabled. True by default.
29
+ # config.http_authenticatable = true
30
+
31
+ # The realm used in Http Basic Authentication
32
+ # config.http_authentication_realm = "Application"
33
+
34
+ # ==> Configuration for :database_authenticatable
35
+ # For bcrypt, this is the cost for hashing the password and defaults to 10. If
36
+ # using other encryptors, it sets how many times you want the password re-encrypted.
37
+ config.stretches = 10
38
+
39
+ # Define which will be the encryption algorithm. Devise also supports encryptors
40
+ # from others authentication tools as :clearance_sha1, :authlogic_sha512 (then
41
+ # you should set stretches above to 20 for default behavior) and :restful_authentication_sha1
42
+ # (then you should set stretches to 10, and copy REST_AUTH_SITE_KEY to pepper)
43
+ config.encryptor = :bcrypt
44
+
45
+ # Setup a pepper to generate the encrypted password.
46
+ config.pepper = "d142367154e5beacca404b1a6a4f8bc52c6fdcfa3ccc3cf8eb49f3458a688ee6ac3b9fae488432a3bfca863b8a90008368a9f3a3dfbe5a962e64b6ab8f3a3a1a"
47
+
48
+ # ==> Configuration for :confirmable
49
+ # The time you want to give your user to confirm his account. During this time
26
50
  # he will be able to access your application without confirming. Default is nil.
51
+ # When confirm_within is zero, the user won't be able to sign in without confirming.
52
+ # You can use this to let your user access some features of your application
53
+ # without confirming the account, but blocking it after a certain period
54
+ # (ie 2 days).
27
55
  # config.confirm_within = 2.days
28
56
 
57
+ # ==> Configuration for :rememberable
29
58
  # The time the user will be remembered without asking for credentials again.
30
59
  # config.remember_for = 2.weeks
31
60
 
32
- # The time you want to timeout the user session without activity. After this
33
- # time the user will be asked for credentials again.
34
- # config.timeout_in = 10.minutes
61
+ # If true, a valid remember token can be re-used between multiple browsers.
62
+ # config.remember_across_browsers = true
35
63
 
36
- # Configure the e-mail address which will be shown in DeviseMailer.
37
- config.mailer_sender = "please-change-me-omg@yourapp.com"
64
+ # If true, extends the user's remember period when remembered via cookie.
65
+ # config.extend_remember_period = false
38
66
 
39
- # Load and configure the ORM. Supports :active_record, :data_mapper and :mongoid.
40
- require "devise/orm/#{DEVISE_ORM}"
67
+ # ==> Configuration for :validatable
68
+ # Range for password length
69
+ # config.password_length = 6..20
41
70
 
42
- # Turn scoped views on. Before rendering "sessions/new", it will first check for
43
- # "sessions/users/new". It's turned off by default because it's slower if you
44
- # are using only default views.
45
- # config.scoped_views = true
71
+ # Regex to use to validate the email address
72
+ # config.email_regexp = /^([\w\.%\+\-]+)@([\w\-]+\.)+([\w]{2,})$/i
46
73
 
47
- # Number of authentication tries before locking an account.
48
- # config.maximum_attempts = 20
74
+ # ==> Configuration for :timeoutable
75
+ # The time you want to timeout the user session without activity. After this
76
+ # time the user will be asked for credentials again.
77
+ # config.timeout_in = 10.minutes
78
+
79
+ # ==> Configuration for :lockable
80
+ # Defines which strategy will be used to lock an account.
81
+ # :failed_attempts = Locks an account after a number of failed attempts to sign in.
82
+ # :none = No lock strategy. You should handle locking by yourself.
83
+ # config.lock_strategy = :failed_attempts
49
84
 
50
85
  # Defines which strategy will be used to unlock an account.
51
86
  # :email = Sends an unlock link to the user email
52
87
  # :time = Re-enables login after a certain amount of time (see :unlock_in below)
53
- # :both = enables both strategies
88
+ # :both = Enables both strategies
89
+ # :none = No unlock strategy. You should handle unlocking by yourself.
54
90
  # config.unlock_strategy = :both
55
91
 
92
+ # Number of authentication tries before locking an account if lock_strategy
93
+ # is failed attempts.
94
+ # config.maximum_attempts = 20
95
+
56
96
  # Time interval to unlock the account if :time is enabled as unlock_strategy.
57
97
  # config.unlock_in = 1.hour
58
98
 
99
+ # ==> Configuration for :token_authenticatable
100
+ # Defines name of the authentication token params key
101
+ # config.token_authentication_key = :auth_token
102
+
103
+ # ==> Scopes configuration
104
+ # Turn scoped views on. Before rendering "sessions/new", it will first check for
105
+ # "users/sessions/new". It's turned off by default because it's slower if you
106
+ # are using only default views.
107
+ # config.scoped_views = true
108
+
109
+ # Configure the default scope given to Warden. By default it's the first
110
+ # devise role declared in your routes.
111
+ # config.default_scope = :user
112
+
113
+ # Configure sign_out behavior.
114
+ # By default sign_out is scoped (i.e. /users/sign_out affects only :user scope).
115
+ # In case of sign_out_all_scopes set to true any logout action will sign out all active scopes.
116
+ # config.sign_out_all_scopes = false
117
+
118
+ # ==> Navigation configuration
119
+ # Lists the formats that should be treated as navigational. Formats like
120
+ # :html, should redirect to the sign in page when the user does not have
121
+ # access, but formats like :xml or :json, should return 401.
122
+ # If you have any extra navigational formats, like :iphone or :mobile, you
123
+ # should add them to the navigational formats lists. Default is [:html]
124
+ # config.navigational_formats = [:html, :iphone]
125
+
126
+ # ==> Warden configuration
59
127
  # If you want to use other strategies, that are not (yet) supported by Devise,
60
128
  # you can configure them inside the config.warden block. The example below
61
129
  # allows you to setup OAuth, using http://github.com/roman/warden_oauth
@@ -66,13 +134,6 @@ Devise.setup do |config|
66
134
  # twitter.consumer_key = <YOUR CONSUMER KEY>
67
135
  # twitter.options :site => 'http://twitter.com'
68
136
  # end
69
- # manager.default_strategies.unshift :twitter_oauth
70
- # end
71
-
72
- # Configure default_url_options if you are using dynamic segments in :path_prefix
73
- # for devise_for.
74
- #
75
- # config.default_url_options do
76
- # { :locale => I18n.locale }
137
+ # manager.default_strategies(:scope => :user).unshift :twitter_oauth
77
138
  # end
78
139
  end
@@ -1,29 +1,47 @@
1
- Rails::Application.routes.draw do
1
+ Rails.application.routes.draw do
2
+ # Resources for testing
2
3
  resources :users, :only => [:index] do
3
4
  get :expire, :on => :member
5
+ get :accept, :on => :member
4
6
  end
5
7
 
6
8
  resources :admins, :only => [:index]
7
9
 
8
- devise_for :users
9
- devise_for :admin, :path => "admin_area", :controllers => { :sessions => "sessions" }, :skip => :passwords
10
- devise_for :accounts, :singular => "manager", :path_prefix => ":locale",
11
- :class_name => "User", :path_names => {
12
- :sign_in => "login", :sign_out => "logout",
13
- :password => "secret", :confirmation => "verification",
14
- :unlock => "unblock", :sign_up => "register",
15
- :registration => "management"
16
- }
10
+ # Users scope
11
+ devise_for :users do
12
+ match "/devise_for/sign_in", :to => "devise/sessions#new"
13
+ end
14
+
15
+ as :user do
16
+ match "/as/sign_in", :to => "devise/sessions#new"
17
+ end
17
18
 
18
- match "/admin_area/home", :to => "admins#index", :as => :admin_root
19
19
  match "/sign_in", :to => "devise/sessions#new"
20
20
 
21
- # Dummy route for new admin pasword
22
- match "/anywhere", :to => "foo#bar", :as => :new_admin_password
21
+ # Admin scope
22
+ devise_for :admin, :path => "admin_area", :controllers => { :sessions => "sessions" }, :skip => :passwords
23
23
 
24
- root :to => "home#index"
24
+ match "/admin_area/home", :to => "admins#index", :as => :admin_root
25
+ match "/anywhere", :to => "foo#bar", :as => :new_admin_password
25
26
 
26
27
  authenticate(:admin) do
27
28
  match "/private", :to => "home#private", :as => :private
28
29
  end
30
+
31
+ # Other routes for routing_test.rb
32
+ namespace :publisher, :path_names => { :sign_in => "i_don_care", :sign_out => "get_out" } do
33
+ devise_for :accounts, :class_name => "User", :path_names => { :sign_in => "get_in" }
34
+ end
35
+
36
+ scope ":locale" do
37
+ devise_for :accounts, :singular => "manager", :class_name => "User",
38
+ :path_names => {
39
+ :sign_in => "login", :sign_out => "logout",
40
+ :password => "secret", :confirmation => "verification",
41
+ :unlock => "unblock", :sign_up => "register",
42
+ :registration => "management"
43
+ }
44
+ end
45
+
46
+ root :to => "home#index"
29
47
  end