devise 1.5.2 → 2.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (130) hide show
  1. data/CHANGELOG.rdoc +104 -70
  2. data/MIT-LICENSE +1 -1
  3. data/README.rdoc +4 -2
  4. data/app/controllers/devise/confirmations_controller.rb +3 -6
  5. data/app/controllers/devise/omniauth_callbacks_controller.rb +1 -3
  6. data/app/controllers/devise/passwords_controller.rb +3 -6
  7. data/app/controllers/devise/registrations_controller.rb +40 -42
  8. data/app/controllers/devise/sessions_controller.rb +2 -3
  9. data/app/controllers/devise/unlocks_controller.rb +4 -7
  10. data/app/controllers/devise_controller.rb +169 -0
  11. data/app/views/devise/_links.erb +25 -0
  12. data/app/views/devise/confirmations/new.html.erb +1 -1
  13. data/app/views/devise/mailer/confirmation_instructions.html.erb +1 -1
  14. data/app/views/devise/passwords/edit.html.erb +1 -1
  15. data/app/views/devise/passwords/new.html.erb +1 -1
  16. data/app/views/devise/registrations/new.html.erb +1 -1
  17. data/app/views/devise/sessions/new.html.erb +1 -1
  18. data/app/views/devise/shared/_links.erb +3 -25
  19. data/app/views/devise/unlocks/new.html.erb +1 -1
  20. data/config/locales/en.yml +5 -6
  21. data/lib/devise/controllers/helpers.rb +8 -2
  22. data/lib/devise/controllers/scoped_views.rb +0 -16
  23. data/lib/devise/controllers/url_helpers.rb +16 -2
  24. data/lib/devise/delegator.rb +2 -2
  25. data/lib/devise/failure_app.rb +43 -8
  26. data/lib/devise/mapping.rb +1 -4
  27. data/lib/devise/models/authenticatable.rb +22 -1
  28. data/lib/devise/models/confirmable.rb +80 -22
  29. data/lib/devise/models/database_authenticatable.rb +0 -11
  30. data/lib/devise/models/lockable.rb +1 -1
  31. data/lib/devise/models/recoverable.rb +5 -5
  32. data/lib/devise/models/rememberable.rb +5 -20
  33. data/lib/devise/models/serializable.rb +5 -2
  34. data/lib/devise/models/timeoutable.rb +1 -3
  35. data/lib/devise/models/token_authenticatable.rb +1 -4
  36. data/lib/devise/models/validatable.rb +1 -1
  37. data/lib/devise/models.rb +1 -1
  38. data/lib/devise/modules.rb +2 -2
  39. data/lib/devise/orm/active_record.rb +6 -0
  40. data/lib/devise/param_filter.rb +1 -1
  41. data/lib/devise/path_checker.rb +7 -2
  42. data/lib/devise/rails/routes.rb +23 -14
  43. data/lib/devise/rails/warden_compat.rb +0 -83
  44. data/lib/devise/rails.rb +61 -0
  45. data/lib/devise/schema.rb +5 -0
  46. data/lib/devise/strategies/authenticatable.rb +14 -10
  47. data/lib/devise/strategies/token_authenticatable.rb +3 -3
  48. data/lib/devise/version.rb +1 -1
  49. data/lib/devise.rb +56 -33
  50. data/lib/generators/active_record/devise_generator.rb +40 -2
  51. data/lib/generators/active_record/templates/migration.rb +1 -19
  52. data/lib/generators/active_record/templates/migration_existing.rb +1 -9
  53. data/lib/generators/devise/views_generator.rb +6 -14
  54. data/lib/generators/mongoid/devise_generator.rb +43 -0
  55. data/lib/generators/templates/devise.rb +26 -12
  56. data/lib/generators/templates/simple_form_for/confirmations/new.html.erb +1 -1
  57. data/lib/generators/templates/simple_form_for/passwords/edit.html.erb +1 -1
  58. data/lib/generators/templates/simple_form_for/passwords/new.html.erb +1 -1
  59. data/lib/generators/templates/simple_form_for/registrations/new.html.erb +1 -1
  60. data/lib/generators/templates/simple_form_for/sessions/new.html.erb +1 -1
  61. data/lib/generators/templates/simple_form_for/unlocks/new.html.erb +1 -1
  62. data/test/controllers/internal_helpers_test.rb +5 -4
  63. data/test/delegator_test.rb +19 -0
  64. data/test/devise_test.rb +2 -2
  65. data/test/failure_app_test.rb +24 -20
  66. data/test/generators/active_record_generator_test.rb +3 -13
  67. data/test/generators/views_generator_test.rb +1 -1
  68. data/test/integration/authenticatable_test.rb +4 -7
  69. data/test/integration/confirmable_test.rb +55 -3
  70. data/test/integration/http_authenticatable_test.rb +20 -5
  71. data/test/integration/lockable_test.rb +26 -14
  72. data/test/integration/registerable_test.rb +33 -2
  73. data/test/integration/rememberable_test.rb +0 -50
  74. data/test/integration/timeoutable_test.rb +18 -4
  75. data/test/integration/token_authenticatable_test.rb +5 -5
  76. data/test/integration/trackable_test.rb +6 -6
  77. data/test/mapping_test.rb +2 -3
  78. data/test/models/confirmable_test.rb +101 -8
  79. data/test/models/database_authenticatable_test.rb +6 -0
  80. data/test/models/encryptable_test.rb +1 -1
  81. data/test/models/lockable_test.rb +13 -0
  82. data/test/models/recoverable_test.rb +0 -27
  83. data/test/models/rememberable_test.rb +41 -160
  84. data/test/models/serializable_test.rb +1 -1
  85. data/test/models_test.rb +7 -7
  86. data/test/path_checker_test.rb +21 -0
  87. data/test/rails_app/app/mongoid/admin.rb +22 -1
  88. data/test/rails_app/app/mongoid/user.rb +35 -0
  89. data/test/rails_app/config/initializers/devise.rb +6 -7
  90. data/test/rails_app/config/routes.rb +3 -5
  91. data/test/rails_app/db/migrate/20100401102949_create_tables.rb +58 -12
  92. data/test/rails_app/lib/shared_admin.rb +6 -2
  93. data/test/rails_app/log/development.log +13 -0
  94. data/test/rails_app/log/test.log +319550 -0
  95. data/test/routes_test.rb +4 -0
  96. data/test/support/assertions.rb +4 -1
  97. data/test/support/helpers.rb +0 -17
  98. data/test/support/integration.rb +3 -1
  99. data/test/test_helpers_test.rb +2 -2
  100. data/test/tmp/app/views/devise/_links.erb +25 -0
  101. data/test/tmp/app/views/devise/confirmations/new.html.erb +15 -0
  102. data/test/tmp/app/views/devise/mailer/confirmation_instructions.html.erb +5 -0
  103. data/test/tmp/app/views/devise/mailer/reset_password_instructions.html.erb +8 -0
  104. data/test/tmp/app/views/devise/mailer/unlock_instructions.html.erb +7 -0
  105. data/test/tmp/app/views/devise/passwords/edit.html.erb +19 -0
  106. data/test/tmp/app/views/devise/passwords/new.html.erb +15 -0
  107. data/test/tmp/app/views/devise/registrations/edit.html.erb +22 -0
  108. data/test/tmp/app/views/devise/registrations/new.html.erb +17 -0
  109. data/test/tmp/app/views/devise/sessions/new.html.erb +15 -0
  110. data/test/tmp/app/views/devise/unlocks/new.html.erb +15 -0
  111. data/test/tmp/app/views/users/_links.erb +25 -0
  112. data/test/tmp/app/views/users/confirmations/new.html.erb +15 -0
  113. data/test/tmp/app/views/users/mailer/confirmation_instructions.html.erb +5 -0
  114. data/test/tmp/app/views/users/mailer/reset_password_instructions.html.erb +8 -0
  115. data/test/tmp/app/views/users/mailer/unlock_instructions.html.erb +7 -0
  116. data/test/tmp/app/views/users/passwords/edit.html.erb +19 -0
  117. data/test/tmp/app/views/users/passwords/new.html.erb +15 -0
  118. data/test/tmp/app/views/users/registrations/edit.html.erb +22 -0
  119. data/test/tmp/app/views/users/registrations/new.html.erb +17 -0
  120. data/test/tmp/app/views/users/sessions/new.html.erb +15 -0
  121. data/test/tmp/app/views/users/unlocks/new.html.erb +15 -0
  122. metadata +83 -27
  123. data/.gitignore +0 -12
  124. data/.travis.yml +0 -13
  125. data/Gemfile +0 -35
  126. data/Rakefile +0 -34
  127. data/devise.gemspec +0 -25
  128. data/lib/devise/controllers/internal_helpers.rb +0 -154
  129. data/lib/devise/controllers/shared_helpers.rb +0 -26
  130. data/test/schema_test.rb +0 -33
data/CHANGELOG.rdoc CHANGED
@@ -1,8 +1,42 @@
1
+ == 2.0.0
2
+
3
+ Notes: https://github.com/plataformatec/devise/wiki/How-To:-Upgrade-to-Devise-2.0
4
+
5
+ * enhancements
6
+ * Add support for e-mail reconfirmation on change (by @Mandaryn and @heimidal)
7
+ * Redirect users to sign in page after unlock (by @nashby)
8
+ * Redirect to the previous URL on timeout
9
+ * Inherit from the same Devise parent controller (by @sj26)
10
+ * Allow parent_controller to be customizable via Devise.parent_controller, useful for engines
11
+ * Allow router_name to be customizable via Devise.router_name, useful for engines
12
+ * Allow alternate ORMs to run compatibility setup code before Authenticatable is included (by @jm81)
13
+
14
+ * deprecation
15
+ * Devise now only supports Rails 3.1 forward
16
+ * Devise.confirm_within was deprecated in favor Devise.allow_unconfirmed_access_for
17
+ * Devise.stateless_token= is deprecated in favor of appending :token_auth to Devise.skip_session_storage
18
+ * Usage of Devise.apply_schema is deprecated
19
+ * Usage of Devise migration helpers are deprecated
20
+ * Usage of Devise.remember_across_browsers was deprecated
21
+ * Usage of rememberable with remember_token was removed
22
+ * Usage of recoverable without reset_password_sent_at was removed
23
+ * Usage of Devise.case_insensitive_keys equals to false was removed
24
+ * Move devise/shared/_links.erb to devise/_links.erb
25
+ * Deprecated support of nested devise_for blocks
26
+ * Deprecated support to devise.registrations.reasons and devise.registrations.inactive_signed_up in favor of devise.registrations.signed_up_but_*
27
+
28
+ == 1.5.3
29
+
30
+ * bug fix
31
+ * Ensure delegator converts scope to symbol (by @dmitriy-kiriyenko)
32
+ * Ensure passing :format => false to devise_for is not permanent
33
+ * Ensure path checker does not check invalid routes
34
+
1
35
  == 1.5.2
2
36
 
3
37
  * enhancements
4
- * Add support for rails 3.1 new mass assignment conventions (by github.com/kirs)
5
- * Add timeout_in method to Timeoutable, it can be overriden in a model (by github.com/lest)
38
+ * Add support for Rails 3.1 new mass assignment conventions (by @kirs)
39
+ * Add timeout_in method to Timeoutable, it can be overridden in a model (by @lest)
6
40
 
7
41
  * bug fix
8
42
  * OmniAuth error message now shows the proper option (:strategy_class instead of :klass)
@@ -17,10 +51,10 @@
17
51
  * enhancements
18
52
  * Timeoutable also skips tracking if skip_trackable is given
19
53
  * devise_for now accepts :failure_app as an option
20
- * Models can select the proper mailer via devise_mailer method (by github.com/locomotivecms)
21
- * Migration generator now uses the change method (by github.com/nashby)
22
- * Support to markerb templates on the mailer generator (by github.com/sbounmy)
23
- * Support for Omniauth 1.0 (older versions are no longer supported) (by github.com/TamiasSibiricus)
54
+ * Models can select the proper mailer via devise_mailer method (by @locomotivecms)
55
+ * Migration generator now uses the change method (by @nashby)
56
+ * Support to markerb templates on the mailer generator (by @sbounmy)
57
+ * Support for Omniauth 1.0 (older versions are no longer supported) (by @TamiasSibiricus)
24
58
 
25
59
  * bug fix
26
60
  * Allow idempotent API requests
@@ -63,7 +97,7 @@
63
97
 
64
98
  * bug fix
65
99
  * Failure app tries the root path if a session one does not exist
66
- * No need to finalize Devise helpers all the time (by github.com/bradleypriest)
100
+ * No need to finalize Devise helpers all the time (by @bradleypriest)
67
101
  * Reset password shows proper message if user is not active
68
102
  * `clean_up_passwords` sets the accessors to nil to skip validations
69
103
 
@@ -98,7 +132,7 @@
98
132
  * enhancements
99
133
  * Add :defaults and :format support on router
100
134
  * Add simple form generators
101
- * Better localization for devise_error_messages! (by github.com/zedtux)
135
+ * Better localization for devise_error_messages! (by @zedtux)
102
136
 
103
137
  * bug fix
104
138
  * Ensure to_xml is properly white listened
@@ -107,20 +141,20 @@
107
141
  == 1.4.0
108
142
 
109
143
  * enhancements
110
- * Added authenticated and unauthenticated to the router to route the used based on his status (by github.com/sj26)
111
- * Improve e-mail regexp (by github.com/rodrigoflores)
112
- * Add strip_whitespace_keys and default to e-mail (by github.com/swrobel)
113
- * Do not run format and uniqueness validations on e-mail if it hasn't changed (by github.com/Thibaut)
114
- * Added update_without_password to update models but not allowing the password to change (by github.com/fschwahn)
115
- * Added config.paranoid, check the generator for more information (by github.com/rodrigoflores)
144
+ * Added authenticated and unauthenticated to the router to route the used based on his status (by @sj26)
145
+ * Improve e-mail regexp (by @rodrigoflores)
146
+ * Add strip_whitespace_keys and default to e-mail (by @swrobel)
147
+ * Do not run format and uniqueness validations on e-mail if it hasn't changed (by @Thibaut)
148
+ * Added update_without_password to update models but not allowing the password to change (by @fschwahn)
149
+ * Added config.paranoid, check the generator for more information (by @rodrigoflores)
116
150
 
117
151
  * bug fix
118
152
  * password_required? should not affect length validation
119
153
  * User cannot access sign up and similar pages if he is already signed in through a cookie or token
120
- * Do not convert booleans to strings on finders (by github.com/xavier)
121
- * Run validations even if current_password fails (by github.com/crx)
122
- * Devise now honors routes constraints (by github.com/macmartine)
123
- * Do not return the user resource when requesting instructions (by github.com/rodrigoflores)
154
+ * Do not convert booleans to strings on finders (by @xavier)
155
+ * Run validations even if current_password fails (by @crx)
156
+ * Devise now honors routes constraints (by @macmartine)
157
+ * Do not return the user resource when requesting instructions (by @rodrigoflores)
124
158
 
125
159
  == 1.3.4
126
160
 
@@ -135,31 +169,31 @@
135
169
  == 1.3.2
136
170
 
137
171
  * bug fix
138
- * Fix another regression related to reset_password_sent_at (by github.com/alexdreher)
172
+ * Fix another regression related to reset_password_sent_at (by @alexdreher)
139
173
 
140
174
  == 1.3.1
141
175
 
142
176
  * enhancements
143
- * Improve failure_app responses (by github.com/indirect)
177
+ * Improve failure_app responses (by @indirect)
144
178
  * sessions/new and registrations/new also respond to xml and json now
145
179
 
146
180
  * bug fix
147
- * Fix a regression that occurred if reset_password_sent_at is not present (by github.com/stevehodgkiss)
181
+ * Fix a regression that occurred if reset_password_sent_at is not present (by @stevehodgkiss)
148
182
 
149
183
  == 1.3.0
150
184
 
151
185
  * enhancements
152
- * All controllers can now handle different mime types than html using Responders (by github.com/sikachu)
153
- * Added reset_password_within as configuration option to send the token for recovery (by github.com/jdguyot)
154
- * Bump password length to 128 characters (by github.com/k33l0r)
155
- * Add :only as option to devise_for (by github.com/timoschilling)
156
- * Allow to override path after sending password instructions (by github.com/irohiroki)
157
- * require_no_authentication has its own flash message (by github.com/jackdempsey)
186
+ * All controllers can now handle different mime types than html using Responders (by @sikachu)
187
+ * Added reset_password_within as configuration option to send the token for recovery (by @jdguyot)
188
+ * Bump password length to 128 characters (by @k33l0r)
189
+ * Add :only as option to devise_for (by @timoschilling)
190
+ * Allow to override path after sending password instructions (by @irohiroki)
191
+ * require_no_authentication has its own flash message (by @jackdempsey)
158
192
 
159
193
  * bug fix
160
194
  * Fix a bug where configuration options were being included too late
161
- * Ensure Devise::TestHelpers can be used to tests Devise internal controllers (by github.com/jwilger)
162
- * valid_password? should not choke on empty passwords (by github.com/mikel)
195
+ * Ensure Devise::TestHelpers can be used to tests Devise internal controllers (by @jwilger)
196
+ * valid_password? should not choke on empty passwords (by @mikel)
163
197
  * Calling devise more than once does not include previously added modules anymore
164
198
  * downcase_keys before validation
165
199
 
@@ -186,16 +220,16 @@
186
220
 
187
221
  * bug fix
188
222
  * Fix an issue causing infinite redirects in production
189
- * rails g destroy works properly with devise generators (by github.com/andmej)
190
- * before_failure callbacks should work on test helpers (by github.com/twinge)
191
- * rememberable cookie now is httponly by default (by github.com/JamesFerguson)
192
- * Add missing confirmation_keys (by github.com/JohnPlummer)
223
+ * rails g destroy works properly with devise generators (by @andmej)
224
+ * before_failure callbacks should work on test helpers (by @twinge)
225
+ * rememberable cookie now is httponly by default (by @JamesFerguson)
226
+ * Add missing confirmation_keys (by @JohnPlummer)
193
227
  * Ensure after_* hooks are called on RegistrationsController
194
228
  * When using database_authenticatable Devise will now only create an email field when appropriate (if using default authentication_keys or custom authentication_keys with email included)
195
- * Ensure stateless token does not trigger timeout (by github.com/pixelauthority)
229
+ * Ensure stateless token does not trigger timeout (by @pixelauthority)
196
230
  * Implement handle_unverified_request for Rails 3.0.4 compatibility and improve FailureApp reliance on symbols
197
231
  * Consider namespaces while generating routes
198
- * Custom failure apps no longer ignored in test mode (by github.com/jaghion)
232
+ * Custom failure apps no longer ignored in test mode (by @jaghion)
199
233
  * Do not depend on ActiveModel::Dirty
200
234
  * Manual sign_in now triggers remember token
201
235
  * Be sure to halt strategies on failures
@@ -204,7 +238,7 @@
204
238
  * Ensure there is no Mongoid injection
205
239
 
206
240
  * deprecations
207
- * Deprecated anybody_signed_in? in favor of signed_in? (by github.com/gavinhughes)
241
+ * Deprecated anybody_signed_in? in favor of signed_in? (by @gavinhughes)
208
242
  * Removed --haml and --slim view templates
209
243
  * Devise::OmniAuth helpers were deprecated and removed in favor of Omniauth.config.test_mode
210
244
 
@@ -217,11 +251,11 @@
217
251
  * enhancements
218
252
  * Added OmniAuth support
219
253
  * Added ORM adapter to abstract ORM iteraction
220
- * sign_out_via is available in the router to configure the method used for sign out (by github.com/martinrehfeld)
221
- * Improved Ajax requests handling in failure app (by github.com/spastorino)
254
+ * sign_out_via is available in the router to configure the method used for sign out (by @martinrehfeld)
255
+ * Improved Ajax requests handling in failure app (by @spastorino)
222
256
  * Added request_keys to easily use request specific values (like subdomain) in authentication
223
257
  * Increased the size of friendly_token to 60 characters (reduces the chances of a successful brute attack)
224
- * Ensure the friendly token does not include "_" or "-" since some e-mails may not autolink it properly (by github.com/rymai)
258
+ * Ensure the friendly token does not include "_" or "-" since some e-mails may not autolink it properly (by @rymai)
225
259
  * Extracted encryptors into :encryptable for better bcrypt support
226
260
  * :rememberable is now able to use salt as token if no remember_token is provided
227
261
  * Store the salt in session and expire the session if the user changes his password
@@ -230,7 +264,7 @@
230
264
  * Sign up now check if the user is active or not and redirect him accordingly setting the inactive_signed_up message
231
265
  * Use ActiveModel#to_key instead of #id
232
266
  * sign_out_all_scopes now destroys the whole session
233
- * Added case_insensitive_keys that automatically downcases the given keys, by default downcases only e-mail (by github.com/adahl)
267
+ * Added case_insensitive_keys that automatically downcases the given keys, by default downcases only e-mail (by @adahl)
234
268
 
235
269
  * default behavior changes
236
270
  * sign_out_all_scopes defaults to true as security measure
@@ -239,12 +273,12 @@
239
273
 
240
274
  * bugfix
241
275
  * after_sign_in_path_for always receives a resource
242
- * Do not execute Warden::Callbacks on Devise::TestHelpers (by github.com/sgronblo)
243
- * Allow password recovery and account unlocking to change used keys (by github.com/RStankov)
276
+ * Do not execute Warden::Callbacks on Devise::TestHelpers (by @sgronblo)
277
+ * Allow password recovery and account unlocking to change used keys (by @RStankov)
244
278
  * FailureApp now properly handles nil request.format
245
279
  * Fix a bug causing FailureApp to return with HTTP Auth Headers for IE7
246
280
  * Ensure namespaces has proper scoped views
247
- * Ensure Devise does not set empty flash messages (by github.com/sxross)
281
+ * Ensure Devise does not set empty flash messages (by @sxross)
248
282
 
249
283
  == 1.1.6
250
284
 
@@ -269,11 +303,11 @@
269
303
 
270
304
  * bugfix
271
305
  * Add reply-to to e-mail headers by default
272
- * Updated the views generator to respect the rails :template_engine option (by github.com/fredwu)
306
+ * Updated the views generator to respect the rails :template_engine option (by @fredwu)
273
307
  * Check the type of HTTP Authentication before using Basic headers
274
- * Avoid invalid_salt errors by checking salt presence (by github.com/thibaudgg)
275
- * Forget user deletes the right cookie before logout, not remembering the user anymore (by github.com/emtrane)
276
- * Fix for failed first-ever logins on PostgreSQL where column default is nil (by github.com/bensie)
308
+ * Avoid invalid_salt errors by checking salt presence (by @thibaudgg)
309
+ * Forget user deletes the right cookie before logout, not remembering the user anymore (by @emtrane)
310
+ * Fix for failed first-ever logins on PostgreSQL where column default is nil (by @bensie)
277
311
  * :default options is now honored in migrations
278
312
 
279
313
  == 1.1.2
@@ -289,16 +323,16 @@
289
323
  == 1.1.0
290
324
 
291
325
  * enhancements
292
- * Rememberable module allows user to be remembered across browsers and is enabled by default (by github.com/trevorturk)
293
- * Rememberable module allows you to activate the period the remember me token is extended (by github.com/trevorturk)
326
+ * Rememberable module allows user to be remembered across browsers and is enabled by default (by @trevorturk)
327
+ * Rememberable module allows you to activate the period the remember me token is extended (by @trevorturk)
294
328
  * devise_for can now be used together with scope method in routes but with a few limitations (check the documentation)
295
329
  * Support `as` or `devise_scope` in the router to specify controller access scope
296
- * HTTP Basic Auth can now be disabled/enabled for xhr(ajax) requests using http_authenticatable_on_xhr option (by github.com/pellja)
330
+ * HTTP Basic Auth can now be disabled/enabled for xhr(ajax) requests using http_authenticatable_on_xhr option (by @pellja)
297
331
 
298
332
  * bug fix
299
333
  * Fix a bug in Devise::TestHelpers where current_user was returning a Response object for non active accounts
300
334
  * Devise should respect script_name and path_info contracts
301
- * Fix a bug when accessing a path with (.:format) (by github.com/klacointe)
335
+ * Fix a bug when accessing a path with (.:format) (by @klacointe)
302
336
  * Do not add unlock routes unless unlock strategy is email or both
303
337
  * Email should be case insensitive
304
338
  * Store classes as string in session, to avoid serialization and stale data issues
@@ -309,10 +343,10 @@
309
343
  == 1.1.rc2
310
344
 
311
345
  * enhancements
312
- * Allow to set cookie domain for the remember token. (by github.com/mantas)
346
+ * Allow to set cookie domain for the remember token. (by @mantas)
313
347
  * Added navigational formats to specify when it should return a 302 and when a 401.
314
- * Added authenticate(scope) support in routes (by github.com/wildchild)
315
- * Added after_update_path_for to registrations controller (by github.com/thedelchop)
348
+ * Added authenticate(scope) support in routes (by @wildchild)
349
+ * Added after_update_path_for to registrations controller (by @thedelchop)
316
350
  * Allow the mailer object to be replaced through config.mailer = "MyOwnMailer"
317
351
 
318
352
  * bug fix
@@ -360,10 +394,10 @@
360
394
 
361
395
  * enhancements
362
396
  * Support for latest MongoMapper
363
- * Added anybody_signed_in? helper (by github.com/SSDany)
397
+ * Added anybody_signed_in? helper (by @SSDany)
364
398
 
365
399
  * bug fix
366
- * confirmation_required? is properly honored on active? calls. (by github.com/paulrosania)
400
+ * confirmation_required? is properly honored on active? calls. (by @paulrosania)
367
401
 
368
402
  == 1.0.7
369
403
 
@@ -404,7 +438,7 @@
404
438
  == 1.0.2
405
439
 
406
440
  * enhancements
407
- * Allows you set mailer content type (by github.com/glennr)
441
+ * Allows you set mailer content type (by @glennr)
408
442
 
409
443
  * bug fix
410
444
  * Uses the same content type as request on http authenticatable 401 responses
@@ -437,12 +471,12 @@
437
471
 
438
472
  * enhancements
439
473
  * Added gemspec to repo
440
- * Added token authenticatable (by github.com/grimen)
474
+ * Added token authenticatable (by @grimen)
441
475
 
442
476
  == 0.9.1
443
477
 
444
478
  * bug fix
445
- * Allow bigger salt size (by github.com/jgeiger)
479
+ * Allow bigger salt size (by @jgeiger)
446
480
  * Fix relative url root
447
481
 
448
482
  == 0.9.0
@@ -452,11 +486,11 @@
452
486
  * :success and :failure flash messages are now :notice and :alert
453
487
 
454
488
  * enhancements
455
- * Added devise lockable (by github.com/mhfs)
489
+ * Added devise lockable (by @mhfs)
456
490
  * Warden 0.9.0 compatibility
457
491
  * Mongomapper 0.6.10 compatibility
458
- * Added Devise.add_module as hooks for extensions (by github.com/grimen)
459
- * Ruby 1.9.1 compatibility (by github.com/grimen)
492
+ * Added Devise.add_module as hooks for extensions (by @grimen)
493
+ * Ruby 1.9.1 compatibility (by @grimen)
460
494
 
461
495
  * bug fix
462
496
  * Accept path prefix not starting with slash
@@ -465,10 +499,10 @@
465
499
  == 0.8.2
466
500
 
467
501
  * enhancements
468
- * Allow Devise.mailer_sender to be a proc (by github.com/grimen)
502
+ * Allow Devise.mailer_sender to be a proc (by @grimen)
469
503
 
470
504
  * bug fix
471
- * Fix bug with passenger, update is required to anyone deploying on passenger (by github.com/dvdpalm)
505
+ * Fix bug with passenger, update is required to anyone deploying on passenger (by @dvdpalm)
472
506
 
473
507
  == 0.8.1
474
508
 
@@ -485,11 +519,11 @@
485
519
  * enhancements
486
520
  * Warden 0.8.0 compatibility
487
521
  * Add an easy for map.connect "sign_in", :controller => "sessions", :action => "new" to work
488
- * Added :bcrypt encryptor (by github.com/capotej)
522
+ * Added :bcrypt encryptor (by @capotej)
489
523
 
490
524
  * bug fix
491
525
  * sign_in_count is also increased when user signs in via password change, confirmation, etc..
492
- * More DataMapper compatibility (by github.com/lancecarlson)
526
+ * More DataMapper compatibility (by @lancecarlson)
493
527
 
494
528
  * deprecation
495
529
  * Removed DeviseMailer.sender
@@ -529,7 +563,7 @@
529
563
  == 0.7.1
530
564
 
531
565
  * enhancements
532
- * Small enhancements for other plugins compatibility (by github.com/grimen)
566
+ * Small enhancements for other plugins compatibility (by @grimen)
533
567
 
534
568
  == 0.7.0
535
569
 
@@ -623,9 +657,9 @@
623
657
  * Fixed a bug where remember me module was not working properly
624
658
 
625
659
  * enhancements
626
- * Moved encryption strategy into the Encryptors module to allow several algorithms (by github.com/mhfs)
627
- * Implemented encryptors for Clearance, Authlogic and Restful-Authentication (by github.com/mhfs)
628
- * Added support for MongoMapper (by github.com/shingara)
660
+ * Moved encryption strategy into the Encryptors module to allow several algorithms (by @mhfs)
661
+ * Implemented encryptors for Clearance, Authlogic and Restful-Authentication (by @mhfs)
662
+ * Added support for MongoMapper (by @shingara)
629
663
 
630
664
  == 0.4.3
631
665
 
data/MIT-LICENSE CHANGED
@@ -1,4 +1,4 @@
1
- Copyright 2009-2011 Plataforma Tecnologia. http://blog.plataformatec.com.br
1
+ Copyright 2009-2012 Plataforma Tecnologia. http://blog.plataformatec.com.br
2
2
 
3
3
  Permission is hereby granted, free of charge, to any person obtaining
4
4
  a copy of this software and associated documentation files (the
data/README.rdoc CHANGED
@@ -1,3 +1,5 @@
1
+ *IMPORTANT:* Devise 2.0.0 is out. If you are upgrading, please read: https://github.com/plataformatec/devise/wiki/How-To:-Upgrade-to-Devise-2.0
2
+
1
3
  == Devise
2
4
 
3
5
  {<img src="https://secure.travis-ci.org/plataformatec/devise.png" />}[http://travis-ci.org/plataformatec/devise]
@@ -210,7 +212,7 @@ Devise allows you to set up as many roles as you want. For example, you may have
210
212
 
211
213
  We built Devise to help you quickly develop an application that uses authentication. However, we don't want to be in your way when you need to customize it.
212
214
 
213
- Since Devise is an engine, all its views are packaged inside the gem. These views will help you get started, but after sometime you may want to change them. If this is the case, you just need to invoke the following generator, and it will copy all views to your application:
215
+ Since Devise is an engine, all its views are packaged inside the gem. These views will help you get started, but after some time you may want to change them. If this is the case, you just need to invoke the following generator, and it will copy all views to your application:
214
216
 
215
217
  rails generate devise:views
216
218
 
@@ -363,4 +365,4 @@ https://github.com/plataformatec/devise/contributors
363
365
 
364
366
  == License
365
367
 
366
- MIT License. Copyright 2011 Plataforma Tecnologia. http://blog.plataformatec.com.br
368
+ MIT License. Copyright 2012 Plataforma Tecnologia. http://blog.plataformatec.com.br
@@ -1,10 +1,7 @@
1
- class Devise::ConfirmationsController < ApplicationController
2
- include Devise::Controllers::InternalHelpers
3
-
1
+ class Devise::ConfirmationsController < DeviseController
4
2
  # GET /resource/confirmation/new
5
3
  def new
6
4
  build_resource({})
7
- render_with_scope :new
8
5
  end
9
6
 
10
7
  # POST /resource/confirmation
@@ -14,7 +11,7 @@ class Devise::ConfirmationsController < ApplicationController
14
11
  if successfully_sent?(resource)
15
12
  respond_with({}, :location => after_resending_confirmation_instructions_path_for(resource_name))
16
13
  else
17
- respond_with_navigational(resource){ render_with_scope :new }
14
+ respond_with(resource)
18
15
  end
19
16
  end
20
17
 
@@ -27,7 +24,7 @@ class Devise::ConfirmationsController < ApplicationController
27
24
  sign_in(resource_name, resource)
28
25
  respond_with_navigational(resource){ redirect_to after_confirmation_path_for(resource_name, resource) }
29
26
  else
30
- respond_with_navigational(resource.errors, :status => :unprocessable_entity){ render_with_scope :new }
27
+ respond_with_navigational(resource.errors, :status => :unprocessable_entity){ render :new }
31
28
  end
32
29
  end
33
30
 
@@ -1,6 +1,4 @@
1
- class Devise::OmniauthCallbacksController < ApplicationController
2
- include Devise::Controllers::InternalHelpers
3
-
1
+ class Devise::OmniauthCallbacksController < DeviseController
4
2
  def failure
5
3
  set_flash_message :alert, :failure, :kind => failed_strategy.name.to_s.humanize, :reason => failure_message
6
4
  redirect_to after_omniauth_failure_path_for(resource_name)
@@ -1,11 +1,9 @@
1
- class Devise::PasswordsController < ApplicationController
1
+ class Devise::PasswordsController < DeviseController
2
2
  prepend_before_filter :require_no_authentication
3
- include Devise::Controllers::InternalHelpers
4
3
 
5
4
  # GET /resource/password/new
6
5
  def new
7
6
  build_resource({})
8
- render_with_scope :new
9
7
  end
10
8
 
11
9
  # POST /resource/password
@@ -15,7 +13,7 @@ class Devise::PasswordsController < ApplicationController
15
13
  if successfully_sent?(resource)
16
14
  respond_with({}, :location => after_sending_reset_password_instructions_path_for(resource_name))
17
15
  else
18
- respond_with_navigational(resource){ render_with_scope :new }
16
+ respond_with(resource)
19
17
  end
20
18
  end
21
19
 
@@ -23,7 +21,6 @@ class Devise::PasswordsController < ApplicationController
23
21
  def edit
24
22
  self.resource = resource_class.new
25
23
  resource.reset_password_token = params[:reset_password_token]
26
- render_with_scope :edit
27
24
  end
28
25
 
29
26
  # PUT /resource/password
@@ -36,7 +33,7 @@ class Devise::PasswordsController < ApplicationController
36
33
  sign_in(resource_name, resource)
37
34
  respond_with resource, :location => after_sign_in_path_for(resource)
38
35
  else
39
- respond_with_navigational(resource){ render_with_scope :edit }
36
+ respond_with resource
40
37
  end
41
38
  end
42
39
 
@@ -1,12 +1,11 @@
1
- class Devise::RegistrationsController < ApplicationController
1
+ class Devise::RegistrationsController < DeviseController
2
2
  prepend_before_filter :require_no_authentication, :only => [ :new, :create, :cancel ]
3
3
  prepend_before_filter :authenticate_scope!, :only => [:edit, :update, :destroy]
4
- include Devise::Controllers::InternalHelpers
5
4
 
6
5
  # GET /resource/sign_up
7
6
  def new
8
7
  resource = build_resource({})
9
- respond_with_navigational(resource){ render_with_scope :new }
8
+ respond_with resource
10
9
  end
11
10
 
12
11
  # POST /resource
@@ -19,19 +18,19 @@ class Devise::RegistrationsController < ApplicationController
19
18
  sign_in(resource_name, resource)
20
19
  respond_with resource, :location => after_sign_up_path_for(resource)
21
20
  else
22
- set_flash_message :notice, :inactive_signed_up, :reason => inactive_reason(resource) if is_navigational_format?
21
+ set_flash_message :notice, :"signed_up_but_#{resource.inactive_message}" if is_navigational_format?
23
22
  expire_session_data_after_sign_in!
24
23
  respond_with resource, :location => after_inactive_sign_up_path_for(resource)
25
24
  end
26
25
  else
27
- clean_up_passwords(resource)
28
- respond_with_navigational(resource) { render_with_scope :new }
26
+ clean_up_passwords resource
27
+ respond_with resource
29
28
  end
30
29
  end
31
30
 
32
31
  # GET /resource/edit
33
32
  def edit
34
- render_with_scope :edit
33
+ render :edit
35
34
  end
36
35
 
37
36
  # PUT /resource
@@ -41,12 +40,17 @@ class Devise::RegistrationsController < ApplicationController
41
40
  self.resource = resource_class.to_adapter.get!(send(:"current_#{resource_name}").to_key)
42
41
 
43
42
  if resource.update_with_password(params[resource_name])
44
- set_flash_message :notice, :updated if is_navigational_format?
43
+ if is_navigational_format?
44
+ if resource.respond_to?(:pending_reconfirmation?) && resource.pending_reconfirmation?
45
+ flash_key = :update_needs_confirmation
46
+ end
47
+ set_flash_message :notice, flash_key || :updated
48
+ end
45
49
  sign_in resource_name, resource, :bypass => true
46
50
  respond_with resource, :location => after_update_path_for(resource)
47
51
  else
48
- clean_up_passwords(resource)
49
- respond_with_navigational(resource){ render_with_scope :edit }
52
+ clean_up_passwords resource
53
+ respond_with resource
50
54
  end
51
55
  end
52
56
 
@@ -70,40 +74,34 @@ class Devise::RegistrationsController < ApplicationController
70
74
 
71
75
  protected
72
76
 
73
- # Build a devise resource passing in the session. Useful to move
74
- # temporary session data to the newly created user.
75
- def build_resource(hash=nil)
76
- hash ||= params[resource_name] || {}
77
- self.resource = resource_class.new_with_session(hash, session)
78
- end
79
-
80
- # The path used after sign up. You need to overwrite this method
81
- # in your own RegistrationsController.
82
- def after_sign_up_path_for(resource)
83
- after_sign_in_path_for(resource)
84
- end
77
+ # Build a devise resource passing in the session. Useful to move
78
+ # temporary session data to the newly created user.
79
+ def build_resource(hash=nil)
80
+ hash ||= params[resource_name] || {}
81
+ self.resource = resource_class.new_with_session(hash, session)
82
+ end
85
83
 
86
- # Returns the inactive reason translated.
87
- def inactive_reason(resource)
88
- reason = resource.inactive_message.to_s
89
- I18n.t("devise.registrations.reasons.#{reason}", :default => reason)
90
- end
84
+ # The path used after sign up. You need to overwrite this method
85
+ # in your own RegistrationsController.
86
+ def after_sign_up_path_for(resource)
87
+ after_sign_in_path_for(resource)
88
+ end
91
89
 
92
- # The path used after sign up for inactive accounts. You need to overwrite
93
- # this method in your own RegistrationsController.
94
- def after_inactive_sign_up_path_for(resource)
95
- root_path
96
- end
90
+ # The path used after sign up for inactive accounts. You need to overwrite
91
+ # this method in your own RegistrationsController.
92
+ def after_inactive_sign_up_path_for(resource)
93
+ respond_to?(:root_path) ? root_path : "/"
94
+ end
97
95
 
98
- # The default url to be used after updating a resource. You need to overwrite
99
- # this method in your own RegistrationsController.
100
- def after_update_path_for(resource)
101
- signed_in_root_path(resource)
102
- end
96
+ # The default url to be used after updating a resource. You need to overwrite
97
+ # this method in your own RegistrationsController.
98
+ def after_update_path_for(resource)
99
+ signed_in_root_path(resource)
100
+ end
103
101
 
104
- # Authenticates the current scope and gets the current resource from the session.
105
- def authenticate_scope!
106
- send(:"authenticate_#{resource_name}!", :force => true)
107
- self.resource = send(:"current_#{resource_name}")
108
- end
102
+ # Authenticates the current scope and gets the current resource from the session.
103
+ def authenticate_scope!
104
+ send(:"authenticate_#{resource_name}!", :force => true)
105
+ self.resource = send(:"current_#{resource_name}")
106
+ end
109
107
  end
@@ -1,13 +1,12 @@
1
- class Devise::SessionsController < ApplicationController
1
+ class Devise::SessionsController < DeviseController
2
2
  prepend_before_filter :require_no_authentication, :only => [ :new, :create ]
3
3
  prepend_before_filter :allow_params_authentication!, :only => :create
4
- include Devise::Controllers::InternalHelpers
5
4
 
6
5
  # GET /resource/sign_in
7
6
  def new
8
7
  resource = build_resource
9
8
  clean_up_passwords(resource)
10
- respond_with_navigational(resource, stub_options(resource)){ render_with_scope :new }
9
+ respond_with(resource, stub_options(resource))
11
10
  end
12
11
 
13
12
  # POST /resource/sign_in
@@ -1,11 +1,9 @@
1
- class Devise::UnlocksController < ApplicationController
1
+ class Devise::UnlocksController < DeviseController
2
2
  prepend_before_filter :require_no_authentication
3
- include Devise::Controllers::InternalHelpers
4
3
 
5
4
  # GET /resource/unlock/new
6
5
  def new
7
6
  build_resource({})
8
- render_with_scope :new
9
7
  end
10
8
 
11
9
  # POST /resource/unlock
@@ -15,7 +13,7 @@ class Devise::UnlocksController < ApplicationController
15
13
  if successfully_sent?(resource)
16
14
  respond_with({}, :location => new_session_path(resource_name))
17
15
  else
18
- respond_with_navigational(resource){ render_with_scope :new }
16
+ respond_with(resource)
19
17
  end
20
18
  end
21
19
 
@@ -25,10 +23,9 @@ class Devise::UnlocksController < ApplicationController
25
23
 
26
24
  if resource.errors.empty?
27
25
  set_flash_message :notice, :unlocked if is_navigational_format?
28
- sign_in(resource_name, resource)
29
- respond_with_navigational(resource){ redirect_to after_sign_in_path_for(resource) }
26
+ respond_with_navigational(resource){ redirect_to new_session_path(resource) }
30
27
  else
31
- respond_with_navigational(resource.errors, :status => :unprocessable_entity){ render_with_scope :new }
28
+ respond_with_navigational(resource.errors, :status => :unprocessable_entity){ render :new }
32
29
  end
33
30
  end
34
31
  end