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.
- data/CHANGELOG.rdoc +22 -2
- data/Gemfile +7 -13
- data/Gemfile.lock +118 -0
- data/README.rdoc +15 -13
- data/app/controllers/devise/unlocks_controller.rb +0 -7
- data/app/mailers/devise/mailer.rb +7 -4
- data/app/views/devise/confirmations/new.html.erb +1 -1
- data/app/views/devise/passwords/new.html.erb +1 -1
- data/app/views/devise/unlocks/new.html.erb +1 -1
- data/lib/devise.rb +27 -9
- data/lib/devise/controllers/helpers.rb +19 -5
- data/lib/devise/controllers/internal_helpers.rb +2 -8
- data/lib/devise/encryptors/base.rb +1 -1
- data/lib/devise/encryptors/bcrypt.rb +2 -2
- data/lib/devise/failure_app.rb +6 -2
- data/lib/devise/hooks/rememberable.rb +9 -1
- data/lib/devise/mapping.rb +15 -50
- data/lib/devise/models/authenticatable.rb +8 -0
- data/lib/devise/models/confirmable.rb +10 -6
- data/lib/devise/models/database_authenticatable.rb +9 -1
- data/lib/devise/models/recoverable.rb +6 -1
- data/lib/devise/models/rememberable.rb +36 -7
- data/lib/devise/models/token_authenticatable.rb +5 -5
- data/lib/devise/models/validatable.rb +1 -1
- data/lib/devise/path_checker.rb +7 -2
- data/lib/devise/rails.rb +6 -1
- data/lib/devise/rails/routes.rb +137 -50
- data/lib/devise/rails/warden_compat.rb +16 -2
- data/lib/devise/strategies/authenticatable.rb +12 -0
- data/lib/devise/strategies/base.rb +0 -18
- data/lib/devise/strategies/rememberable.rb +9 -1
- data/lib/devise/test_helpers.rb +2 -0
- data/lib/devise/version.rb +1 -1
- data/lib/generators/active_record/devise_generator.rb +28 -0
- data/lib/generators/{devise/devise → active_record}/templates/migration.rb +4 -0
- data/lib/generators/devise/devise_generator.rb +17 -0
- data/lib/generators/devise/{install/install_generator.rb → install_generator.rb} +1 -1
- data/lib/generators/devise/orm_helpers.rb +23 -0
- data/lib/generators/devise/{install/templates → templates}/README +0 -0
- data/lib/generators/devise/{install/templates → templates}/devise.rb +20 -13
- data/lib/generators/devise/{views/views_generator.rb → views_generator.rb} +2 -2
- data/lib/generators/mongoid/devise_generator.rb +17 -0
- data/test/controllers/helpers_test.rb +9 -0
- data/test/controllers/internal_helpers_test.rb +7 -16
- data/test/controllers/url_helpers_test.rb +11 -0
- data/test/encryptors_test.rb +1 -1
- data/test/failure_app_test.rb +18 -5
- data/test/integration/authenticatable_test.rb +76 -11
- data/test/integration/confirmable_test.rb +16 -9
- data/test/integration/lockable_test.rb +11 -13
- data/test/integration/registerable_test.rb +4 -4
- data/test/integration/rememberable_test.rb +54 -1
- data/test/mapping_test.rb +10 -45
- data/test/models/confirmable_test.rb +1 -1
- data/test/models/rememberable_test.rb +108 -0
- data/test/models/validatable_test.rb +2 -4
- data/test/models_test.rb +4 -4
- data/test/rails_app/app/active_record/admin.rb +1 -1
- data/test/rails_app/app/controllers/publisher/registrations_controller.rb +2 -0
- data/test/rails_app/app/controllers/publisher/sessions_controller.rb +2 -0
- data/test/rails_app/app/controllers/users_controller.rb +5 -1
- data/test/rails_app/app/mongoid/admin.rb +1 -1
- data/test/rails_app/config/application.rb +2 -2
- data/test/rails_app/config/environments/test.rb +2 -0
- data/test/rails_app/config/initializers/devise.rb +95 -34
- data/test/rails_app/config/routes.rb +32 -14
- data/test/routes_test.rb +34 -2
- data/test/support/integration.rb +22 -6
- data/test/test_helpers_test.rb +16 -2
- metadata +24 -27
- data/lib/devise/orm/data_mapper.rb +0 -97
- data/lib/generators/devise/devise/devise_generator.rb +0 -86
- data/lib/generators/devise_generator.rb +0 -2
- data/test/orm/data_mapper.rb +0 -10
- data/test/rails_app/app/data_mapper/admin.rb +0 -12
- data/test/rails_app/app/data_mapper/shim.rb +0 -2
- 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
|
-
|
16
|
+
assert_no_match(/taken/, user.errors[:email].join)
|
19
17
|
|
20
18
|
user.email = existing_user.email
|
21
19
|
assert user.invalid?
|
22
|
-
|
20
|
+
assert_match(/taken/, user.errors[:email].join)
|
23
21
|
end
|
24
22
|
|
25
23
|
test 'should require correct email format, allowing blank' do
|
data/test/models_test.rb
CHANGED
@@ -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,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'
|
@@ -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.
|
21
|
-
config.
|
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|
|
@@ -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
|
-
#
|
5
|
-
# the
|
6
|
-
|
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
|
9
|
-
# config.
|
8
|
+
# Configure the class responsible to send e-mails.
|
9
|
+
# config.mailer = "Devise::Mailer"
|
10
10
|
|
11
|
-
#
|
12
|
-
#
|
13
|
-
#
|
14
|
-
#
|
15
|
-
|
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
|
-
#
|
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
|
-
#
|
33
|
-
#
|
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
|
-
#
|
37
|
-
config.
|
64
|
+
# If true, extends the user's remember period when remembered via cookie.
|
65
|
+
# config.extend_remember_period = false
|
38
66
|
|
39
|
-
#
|
40
|
-
|
67
|
+
# ==> Configuration for :validatable
|
68
|
+
# Range for password length
|
69
|
+
# config.password_length = 6..20
|
41
70
|
|
42
|
-
#
|
43
|
-
#
|
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
|
-
#
|
48
|
-
#
|
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 =
|
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
|
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
|
-
|
9
|
-
devise_for :
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
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
|
-
#
|
22
|
-
|
21
|
+
# Admin scope
|
22
|
+
devise_for :admin, :path => "admin_area", :controllers => { :sessions => "sessions" }, :skip => :passwords
|
23
23
|
|
24
|
-
|
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
|