devise 1.5.3 → 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 (125) hide show
  1. data/CHANGELOG.rdoc +98 -71
  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/failure_app.rb +43 -8
  25. data/lib/devise/models/authenticatable.rb +22 -1
  26. data/lib/devise/models/confirmable.rb +80 -22
  27. data/lib/devise/models/database_authenticatable.rb +0 -11
  28. data/lib/devise/models/lockable.rb +1 -1
  29. data/lib/devise/models/recoverable.rb +5 -5
  30. data/lib/devise/models/rememberable.rb +5 -20
  31. data/lib/devise/models/serializable.rb +5 -2
  32. data/lib/devise/models/timeoutable.rb +1 -3
  33. data/lib/devise/models/token_authenticatable.rb +1 -4
  34. data/lib/devise/models/validatable.rb +1 -1
  35. data/lib/devise/models.rb +1 -1
  36. data/lib/devise/modules.rb +2 -2
  37. data/lib/devise/orm/active_record.rb +6 -0
  38. data/lib/devise/param_filter.rb +1 -1
  39. data/lib/devise/path_checker.rb +5 -1
  40. data/lib/devise/rails/routes.rb +16 -10
  41. data/lib/devise/rails/warden_compat.rb +0 -83
  42. data/lib/devise/rails.rb +61 -0
  43. data/lib/devise/schema.rb +5 -0
  44. data/lib/devise/strategies/authenticatable.rb +14 -10
  45. data/lib/devise/strategies/token_authenticatable.rb +3 -3
  46. data/lib/devise/version.rb +1 -1
  47. data/lib/devise.rb +56 -33
  48. data/lib/generators/active_record/devise_generator.rb +40 -2
  49. data/lib/generators/active_record/templates/migration.rb +1 -19
  50. data/lib/generators/active_record/templates/migration_existing.rb +1 -9
  51. data/lib/generators/devise/views_generator.rb +6 -14
  52. data/lib/generators/mongoid/devise_generator.rb +43 -0
  53. data/lib/generators/templates/devise.rb +26 -12
  54. data/lib/generators/templates/simple_form_for/confirmations/new.html.erb +1 -1
  55. data/lib/generators/templates/simple_form_for/passwords/edit.html.erb +1 -1
  56. data/lib/generators/templates/simple_form_for/passwords/new.html.erb +1 -1
  57. data/lib/generators/templates/simple_form_for/registrations/new.html.erb +1 -1
  58. data/lib/generators/templates/simple_form_for/sessions/new.html.erb +1 -1
  59. data/lib/generators/templates/simple_form_for/unlocks/new.html.erb +1 -1
  60. data/test/controllers/internal_helpers_test.rb +5 -4
  61. data/test/devise_test.rb +2 -2
  62. data/test/failure_app_test.rb +24 -20
  63. data/test/generators/active_record_generator_test.rb +3 -13
  64. data/test/generators/views_generator_test.rb +1 -1
  65. data/test/integration/authenticatable_test.rb +4 -7
  66. data/test/integration/confirmable_test.rb +55 -3
  67. data/test/integration/http_authenticatable_test.rb +20 -5
  68. data/test/integration/lockable_test.rb +26 -14
  69. data/test/integration/registerable_test.rb +33 -2
  70. data/test/integration/rememberable_test.rb +0 -50
  71. data/test/integration/timeoutable_test.rb +18 -4
  72. data/test/integration/token_authenticatable_test.rb +5 -5
  73. data/test/integration/trackable_test.rb +6 -6
  74. data/test/mapping_test.rb +2 -3
  75. data/test/models/confirmable_test.rb +101 -8
  76. data/test/models/database_authenticatable_test.rb +6 -0
  77. data/test/models/encryptable_test.rb +1 -1
  78. data/test/models/lockable_test.rb +13 -0
  79. data/test/models/recoverable_test.rb +0 -27
  80. data/test/models/rememberable_test.rb +41 -160
  81. data/test/models/serializable_test.rb +1 -1
  82. data/test/models_test.rb +7 -7
  83. data/test/rails_app/app/mongoid/admin.rb +22 -1
  84. data/test/rails_app/app/mongoid/user.rb +35 -0
  85. data/test/rails_app/config/initializers/devise.rb +6 -7
  86. data/test/rails_app/config/routes.rb +3 -5
  87. data/test/rails_app/db/migrate/20100401102949_create_tables.rb +58 -12
  88. data/test/rails_app/lib/shared_admin.rb +6 -2
  89. data/test/rails_app/log/development.log +13 -0
  90. data/test/rails_app/log/test.log +319550 -0
  91. data/test/support/assertions.rb +4 -1
  92. data/test/support/helpers.rb +0 -17
  93. data/test/support/integration.rb +3 -1
  94. data/test/test_helpers_test.rb +2 -2
  95. data/test/tmp/app/views/devise/_links.erb +25 -0
  96. data/test/tmp/app/views/devise/confirmations/new.html.erb +15 -0
  97. data/test/tmp/app/views/devise/mailer/confirmation_instructions.html.erb +5 -0
  98. data/test/tmp/app/views/devise/mailer/reset_password_instructions.html.erb +8 -0
  99. data/test/tmp/app/views/devise/mailer/unlock_instructions.html.erb +7 -0
  100. data/test/tmp/app/views/devise/passwords/edit.html.erb +19 -0
  101. data/test/tmp/app/views/devise/passwords/new.html.erb +15 -0
  102. data/test/tmp/app/views/devise/registrations/edit.html.erb +22 -0
  103. data/test/tmp/app/views/devise/registrations/new.html.erb +17 -0
  104. data/test/tmp/app/views/devise/sessions/new.html.erb +15 -0
  105. data/test/tmp/app/views/devise/unlocks/new.html.erb +15 -0
  106. data/test/tmp/app/views/users/_links.erb +25 -0
  107. data/test/tmp/app/views/users/confirmations/new.html.erb +15 -0
  108. data/test/tmp/app/views/users/mailer/confirmation_instructions.html.erb +5 -0
  109. data/test/tmp/app/views/users/mailer/reset_password_instructions.html.erb +8 -0
  110. data/test/tmp/app/views/users/mailer/unlock_instructions.html.erb +7 -0
  111. data/test/tmp/app/views/users/passwords/edit.html.erb +19 -0
  112. data/test/tmp/app/views/users/passwords/new.html.erb +15 -0
  113. data/test/tmp/app/views/users/registrations/edit.html.erb +22 -0
  114. data/test/tmp/app/views/users/registrations/new.html.erb +17 -0
  115. data/test/tmp/app/views/users/sessions/new.html.erb +15 -0
  116. data/test/tmp/app/views/users/unlocks/new.html.erb +15 -0
  117. metadata +78 -26
  118. data/.gitignore +0 -12
  119. data/.travis.yml +0 -13
  120. data/Gemfile +0 -35
  121. data/Rakefile +0 -34
  122. data/devise.gemspec +0 -25
  123. data/lib/devise/controllers/internal_helpers.rb +0 -154
  124. data/lib/devise/controllers/shared_helpers.rb +0 -26
  125. data/test/schema_test.rb +0 -33
data/CHANGELOG.rdoc CHANGED
@@ -1,15 +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
+
1
28
  == 1.5.3
2
29
 
3
30
  * bug fix
4
- * Ensure delegator converts scope to symbol (by github.com/dmitriy-kiriyenko)
31
+ * Ensure delegator converts scope to symbol (by @dmitriy-kiriyenko)
5
32
  * Ensure passing :format => false to devise_for is not permanent
6
33
  * Ensure path checker does not check invalid routes
7
34
 
8
35
  == 1.5.2
9
36
 
10
37
  * enhancements
11
- * Add support for rails 3.1 new mass assignment conventions (by github.com/kirs)
12
- * 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)
13
40
 
14
41
  * bug fix
15
42
  * OmniAuth error message now shows the proper option (:strategy_class instead of :klass)
@@ -24,10 +51,10 @@
24
51
  * enhancements
25
52
  * Timeoutable also skips tracking if skip_trackable is given
26
53
  * devise_for now accepts :failure_app as an option
27
- * Models can select the proper mailer via devise_mailer method (by github.com/locomotivecms)
28
- * Migration generator now uses the change method (by github.com/nashby)
29
- * Support to markerb templates on the mailer generator (by github.com/sbounmy)
30
- * 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)
31
58
 
32
59
  * bug fix
33
60
  * Allow idempotent API requests
@@ -70,7 +97,7 @@
70
97
 
71
98
  * bug fix
72
99
  * Failure app tries the root path if a session one does not exist
73
- * 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)
74
101
  * Reset password shows proper message if user is not active
75
102
  * `clean_up_passwords` sets the accessors to nil to skip validations
76
103
 
@@ -105,7 +132,7 @@
105
132
  * enhancements
106
133
  * Add :defaults and :format support on router
107
134
  * Add simple form generators
108
- * Better localization for devise_error_messages! (by github.com/zedtux)
135
+ * Better localization for devise_error_messages! (by @zedtux)
109
136
 
110
137
  * bug fix
111
138
  * Ensure to_xml is properly white listened
@@ -114,20 +141,20 @@
114
141
  == 1.4.0
115
142
 
116
143
  * enhancements
117
- * Added authenticated and unauthenticated to the router to route the used based on his status (by github.com/sj26)
118
- * Improve e-mail regexp (by github.com/rodrigoflores)
119
- * Add strip_whitespace_keys and default to e-mail (by github.com/swrobel)
120
- * Do not run format and uniqueness validations on e-mail if it hasn't changed (by github.com/Thibaut)
121
- * Added update_without_password to update models but not allowing the password to change (by github.com/fschwahn)
122
- * 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)
123
150
 
124
151
  * bug fix
125
152
  * password_required? should not affect length validation
126
153
  * User cannot access sign up and similar pages if he is already signed in through a cookie or token
127
- * Do not convert booleans to strings on finders (by github.com/xavier)
128
- * Run validations even if current_password fails (by github.com/crx)
129
- * Devise now honors routes constraints (by github.com/macmartine)
130
- * 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)
131
158
 
132
159
  == 1.3.4
133
160
 
@@ -142,31 +169,31 @@
142
169
  == 1.3.2
143
170
 
144
171
  * bug fix
145
- * 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)
146
173
 
147
174
  == 1.3.1
148
175
 
149
176
  * enhancements
150
- * Improve failure_app responses (by github.com/indirect)
177
+ * Improve failure_app responses (by @indirect)
151
178
  * sessions/new and registrations/new also respond to xml and json now
152
179
 
153
180
  * bug fix
154
- * 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)
155
182
 
156
183
  == 1.3.0
157
184
 
158
185
  * enhancements
159
- * All controllers can now handle different mime types than html using Responders (by github.com/sikachu)
160
- * Added reset_password_within as configuration option to send the token for recovery (by github.com/jdguyot)
161
- * Bump password length to 128 characters (by github.com/k33l0r)
162
- * Add :only as option to devise_for (by github.com/timoschilling)
163
- * Allow to override path after sending password instructions (by github.com/irohiroki)
164
- * 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)
165
192
 
166
193
  * bug fix
167
194
  * Fix a bug where configuration options were being included too late
168
- * Ensure Devise::TestHelpers can be used to tests Devise internal controllers (by github.com/jwilger)
169
- * 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)
170
197
  * Calling devise more than once does not include previously added modules anymore
171
198
  * downcase_keys before validation
172
199
 
@@ -193,16 +220,16 @@
193
220
 
194
221
  * bug fix
195
222
  * Fix an issue causing infinite redirects in production
196
- * rails g destroy works properly with devise generators (by github.com/andmej)
197
- * before_failure callbacks should work on test helpers (by github.com/twinge)
198
- * rememberable cookie now is httponly by default (by github.com/JamesFerguson)
199
- * 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)
200
227
  * Ensure after_* hooks are called on RegistrationsController
201
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)
202
- * Ensure stateless token does not trigger timeout (by github.com/pixelauthority)
229
+ * Ensure stateless token does not trigger timeout (by @pixelauthority)
203
230
  * Implement handle_unverified_request for Rails 3.0.4 compatibility and improve FailureApp reliance on symbols
204
231
  * Consider namespaces while generating routes
205
- * 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)
206
233
  * Do not depend on ActiveModel::Dirty
207
234
  * Manual sign_in now triggers remember token
208
235
  * Be sure to halt strategies on failures
@@ -211,7 +238,7 @@
211
238
  * Ensure there is no Mongoid injection
212
239
 
213
240
  * deprecations
214
- * 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)
215
242
  * Removed --haml and --slim view templates
216
243
  * Devise::OmniAuth helpers were deprecated and removed in favor of Omniauth.config.test_mode
217
244
 
@@ -224,11 +251,11 @@
224
251
  * enhancements
225
252
  * Added OmniAuth support
226
253
  * Added ORM adapter to abstract ORM iteraction
227
- * sign_out_via is available in the router to configure the method used for sign out (by github.com/martinrehfeld)
228
- * 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)
229
256
  * Added request_keys to easily use request specific values (like subdomain) in authentication
230
257
  * Increased the size of friendly_token to 60 characters (reduces the chances of a successful brute attack)
231
- * 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)
232
259
  * Extracted encryptors into :encryptable for better bcrypt support
233
260
  * :rememberable is now able to use salt as token if no remember_token is provided
234
261
  * Store the salt in session and expire the session if the user changes his password
@@ -237,7 +264,7 @@
237
264
  * Sign up now check if the user is active or not and redirect him accordingly setting the inactive_signed_up message
238
265
  * Use ActiveModel#to_key instead of #id
239
266
  * sign_out_all_scopes now destroys the whole session
240
- * 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)
241
268
 
242
269
  * default behavior changes
243
270
  * sign_out_all_scopes defaults to true as security measure
@@ -246,12 +273,12 @@
246
273
 
247
274
  * bugfix
248
275
  * after_sign_in_path_for always receives a resource
249
- * Do not execute Warden::Callbacks on Devise::TestHelpers (by github.com/sgronblo)
250
- * 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)
251
278
  * FailureApp now properly handles nil request.format
252
279
  * Fix a bug causing FailureApp to return with HTTP Auth Headers for IE7
253
280
  * Ensure namespaces has proper scoped views
254
- * Ensure Devise does not set empty flash messages (by github.com/sxross)
281
+ * Ensure Devise does not set empty flash messages (by @sxross)
255
282
 
256
283
  == 1.1.6
257
284
 
@@ -276,11 +303,11 @@
276
303
 
277
304
  * bugfix
278
305
  * Add reply-to to e-mail headers by default
279
- * 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)
280
307
  * Check the type of HTTP Authentication before using Basic headers
281
- * Avoid invalid_salt errors by checking salt presence (by github.com/thibaudgg)
282
- * Forget user deletes the right cookie before logout, not remembering the user anymore (by github.com/emtrane)
283
- * 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)
284
311
  * :default options is now honored in migrations
285
312
 
286
313
  == 1.1.2
@@ -296,16 +323,16 @@
296
323
  == 1.1.0
297
324
 
298
325
  * enhancements
299
- * Rememberable module allows user to be remembered across browsers and is enabled by default (by github.com/trevorturk)
300
- * 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)
301
328
  * devise_for can now be used together with scope method in routes but with a few limitations (check the documentation)
302
329
  * Support `as` or `devise_scope` in the router to specify controller access scope
303
- * 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)
304
331
 
305
332
  * bug fix
306
333
  * Fix a bug in Devise::TestHelpers where current_user was returning a Response object for non active accounts
307
334
  * Devise should respect script_name and path_info contracts
308
- * 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)
309
336
  * Do not add unlock routes unless unlock strategy is email or both
310
337
  * Email should be case insensitive
311
338
  * Store classes as string in session, to avoid serialization and stale data issues
@@ -316,10 +343,10 @@
316
343
  == 1.1.rc2
317
344
 
318
345
  * enhancements
319
- * 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)
320
347
  * Added navigational formats to specify when it should return a 302 and when a 401.
321
- * Added authenticate(scope) support in routes (by github.com/wildchild)
322
- * 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)
323
350
  * Allow the mailer object to be replaced through config.mailer = "MyOwnMailer"
324
351
 
325
352
  * bug fix
@@ -367,10 +394,10 @@
367
394
 
368
395
  * enhancements
369
396
  * Support for latest MongoMapper
370
- * Added anybody_signed_in? helper (by github.com/SSDany)
397
+ * Added anybody_signed_in? helper (by @SSDany)
371
398
 
372
399
  * bug fix
373
- * confirmation_required? is properly honored on active? calls. (by github.com/paulrosania)
400
+ * confirmation_required? is properly honored on active? calls. (by @paulrosania)
374
401
 
375
402
  == 1.0.7
376
403
 
@@ -411,7 +438,7 @@
411
438
  == 1.0.2
412
439
 
413
440
  * enhancements
414
- * Allows you set mailer content type (by github.com/glennr)
441
+ * Allows you set mailer content type (by @glennr)
415
442
 
416
443
  * bug fix
417
444
  * Uses the same content type as request on http authenticatable 401 responses
@@ -444,12 +471,12 @@
444
471
 
445
472
  * enhancements
446
473
  * Added gemspec to repo
447
- * Added token authenticatable (by github.com/grimen)
474
+ * Added token authenticatable (by @grimen)
448
475
 
449
476
  == 0.9.1
450
477
 
451
478
  * bug fix
452
- * Allow bigger salt size (by github.com/jgeiger)
479
+ * Allow bigger salt size (by @jgeiger)
453
480
  * Fix relative url root
454
481
 
455
482
  == 0.9.0
@@ -459,11 +486,11 @@
459
486
  * :success and :failure flash messages are now :notice and :alert
460
487
 
461
488
  * enhancements
462
- * Added devise lockable (by github.com/mhfs)
489
+ * Added devise lockable (by @mhfs)
463
490
  * Warden 0.9.0 compatibility
464
491
  * Mongomapper 0.6.10 compatibility
465
- * Added Devise.add_module as hooks for extensions (by github.com/grimen)
466
- * 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)
467
494
 
468
495
  * bug fix
469
496
  * Accept path prefix not starting with slash
@@ -472,10 +499,10 @@
472
499
  == 0.8.2
473
500
 
474
501
  * enhancements
475
- * Allow Devise.mailer_sender to be a proc (by github.com/grimen)
502
+ * Allow Devise.mailer_sender to be a proc (by @grimen)
476
503
 
477
504
  * bug fix
478
- * 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)
479
506
 
480
507
  == 0.8.1
481
508
 
@@ -492,11 +519,11 @@
492
519
  * enhancements
493
520
  * Warden 0.8.0 compatibility
494
521
  * Add an easy for map.connect "sign_in", :controller => "sessions", :action => "new" to work
495
- * Added :bcrypt encryptor (by github.com/capotej)
522
+ * Added :bcrypt encryptor (by @capotej)
496
523
 
497
524
  * bug fix
498
525
  * sign_in_count is also increased when user signs in via password change, confirmation, etc..
499
- * More DataMapper compatibility (by github.com/lancecarlson)
526
+ * More DataMapper compatibility (by @lancecarlson)
500
527
 
501
528
  * deprecation
502
529
  * Removed DeviseMailer.sender
@@ -536,7 +563,7 @@
536
563
  == 0.7.1
537
564
 
538
565
  * enhancements
539
- * Small enhancements for other plugins compatibility (by github.com/grimen)
566
+ * Small enhancements for other plugins compatibility (by @grimen)
540
567
 
541
568
  == 0.7.0
542
569
 
@@ -630,9 +657,9 @@
630
657
  * Fixed a bug where remember me module was not working properly
631
658
 
632
659
  * enhancements
633
- * Moved encryption strategy into the Encryptors module to allow several algorithms (by github.com/mhfs)
634
- * Implemented encryptors for Clearance, Authlogic and Restful-Authentication (by github.com/mhfs)
635
- * 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)
636
663
 
637
664
  == 0.4.3
638
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