devise 1.5.1 → 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 (132) hide show
  1. data/CHANGELOG.rdoc +111 -68
  2. data/MIT-LICENSE +1 -1
  3. data/README.rdoc +7 -4
  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 +5 -16
  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 +9 -7
  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/omniauth/config.rb +1 -1
  40. data/lib/devise/orm/active_record.rb +6 -0
  41. data/lib/devise/param_filter.rb +1 -1
  42. data/lib/devise/path_checker.rb +7 -2
  43. data/lib/devise/rails/routes.rb +23 -14
  44. data/lib/devise/rails/warden_compat.rb +0 -83
  45. data/lib/devise/rails.rb +61 -0
  46. data/lib/devise/schema.rb +5 -0
  47. data/lib/devise/strategies/authenticatable.rb +14 -10
  48. data/lib/devise/strategies/token_authenticatable.rb +3 -3
  49. data/lib/devise/version.rb +1 -1
  50. data/lib/devise.rb +56 -33
  51. data/lib/generators/active_record/devise_generator.rb +40 -2
  52. data/lib/generators/active_record/templates/migration.rb +1 -19
  53. data/lib/generators/active_record/templates/migration_existing.rb +1 -9
  54. data/lib/generators/devise/views_generator.rb +6 -14
  55. data/lib/generators/mongoid/devise_generator.rb +43 -0
  56. data/lib/generators/templates/devise.rb +28 -14
  57. data/lib/generators/templates/simple_form_for/confirmations/new.html.erb +1 -1
  58. data/lib/generators/templates/simple_form_for/passwords/edit.html.erb +1 -1
  59. data/lib/generators/templates/simple_form_for/passwords/new.html.erb +1 -1
  60. data/lib/generators/templates/simple_form_for/registrations/new.html.erb +1 -1
  61. data/lib/generators/templates/simple_form_for/sessions/new.html.erb +1 -1
  62. data/lib/generators/templates/simple_form_for/unlocks/new.html.erb +1 -1
  63. data/test/controllers/internal_helpers_test.rb +5 -4
  64. data/test/delegator_test.rb +19 -0
  65. data/test/devise_test.rb +2 -2
  66. data/test/failure_app_test.rb +24 -20
  67. data/test/generators/active_record_generator_test.rb +3 -13
  68. data/test/generators/views_generator_test.rb +1 -1
  69. data/test/integration/authenticatable_test.rb +4 -7
  70. data/test/integration/confirmable_test.rb +55 -3
  71. data/test/integration/http_authenticatable_test.rb +20 -5
  72. data/test/integration/lockable_test.rb +26 -14
  73. data/test/integration/registerable_test.rb +33 -2
  74. data/test/integration/rememberable_test.rb +0 -50
  75. data/test/integration/timeoutable_test.rb +18 -4
  76. data/test/integration/token_authenticatable_test.rb +5 -5
  77. data/test/integration/trackable_test.rb +6 -6
  78. data/test/mapping_test.rb +2 -3
  79. data/test/models/confirmable_test.rb +101 -8
  80. data/test/models/database_authenticatable_test.rb +19 -0
  81. data/test/models/encryptable_test.rb +1 -1
  82. data/test/models/lockable_test.rb +13 -0
  83. data/test/models/recoverable_test.rb +0 -27
  84. data/test/models/rememberable_test.rb +41 -160
  85. data/test/models/serializable_test.rb +1 -1
  86. data/test/models/timeoutable_test.rb +14 -0
  87. data/test/models_test.rb +7 -7
  88. data/test/path_checker_test.rb +21 -0
  89. data/test/rails_app/app/mongoid/admin.rb +22 -1
  90. data/test/rails_app/app/mongoid/user.rb +35 -0
  91. data/test/rails_app/config/initializers/devise.rb +6 -7
  92. data/test/rails_app/config/routes.rb +3 -5
  93. data/test/rails_app/db/migrate/20100401102949_create_tables.rb +58 -12
  94. data/test/rails_app/lib/shared_admin.rb +6 -2
  95. data/test/rails_app/log/development.log +13 -0
  96. data/test/rails_app/log/test.log +319550 -0
  97. data/test/routes_test.rb +4 -0
  98. data/test/support/assertions.rb +4 -1
  99. data/test/support/helpers.rb +0 -17
  100. data/test/support/integration.rb +3 -1
  101. data/test/test_helpers_test.rb +2 -2
  102. data/test/tmp/app/views/devise/_links.erb +25 -0
  103. data/test/tmp/app/views/devise/confirmations/new.html.erb +15 -0
  104. data/test/tmp/app/views/devise/mailer/confirmation_instructions.html.erb +5 -0
  105. data/test/tmp/app/views/devise/mailer/reset_password_instructions.html.erb +8 -0
  106. data/test/tmp/app/views/devise/mailer/unlock_instructions.html.erb +7 -0
  107. data/test/tmp/app/views/devise/passwords/edit.html.erb +19 -0
  108. data/test/tmp/app/views/devise/passwords/new.html.erb +15 -0
  109. data/test/tmp/app/views/devise/registrations/edit.html.erb +22 -0
  110. data/test/tmp/app/views/devise/registrations/new.html.erb +17 -0
  111. data/test/tmp/app/views/devise/sessions/new.html.erb +15 -0
  112. data/test/tmp/app/views/devise/unlocks/new.html.erb +15 -0
  113. data/test/tmp/app/views/users/_links.erb +25 -0
  114. data/test/tmp/app/views/users/confirmations/new.html.erb +15 -0
  115. data/test/tmp/app/views/users/mailer/confirmation_instructions.html.erb +5 -0
  116. data/test/tmp/app/views/users/mailer/reset_password_instructions.html.erb +8 -0
  117. data/test/tmp/app/views/users/mailer/unlock_instructions.html.erb +7 -0
  118. data/test/tmp/app/views/users/passwords/edit.html.erb +19 -0
  119. data/test/tmp/app/views/users/passwords/new.html.erb +15 -0
  120. data/test/tmp/app/views/users/registrations/edit.html.erb +22 -0
  121. data/test/tmp/app/views/users/registrations/new.html.erb +17 -0
  122. data/test/tmp/app/views/users/sessions/new.html.erb +15 -0
  123. data/test/tmp/app/views/users/unlocks/new.html.erb +15 -0
  124. metadata +83 -27
  125. data/.gitignore +0 -12
  126. data/.travis.yml +0 -13
  127. data/Gemfile +0 -35
  128. data/Rakefile +0 -34
  129. data/devise.gemspec +0 -25
  130. data/lib/devise/controllers/internal_helpers.rb +0 -154
  131. data/lib/devise/controllers/shared_helpers.rb +0 -26
  132. data/test/schema_test.rb +0 -33
data/CHANGELOG.rdoc CHANGED
@@ -1,3 +1,46 @@
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
+
35
+ == 1.5.2
36
+
37
+ * enhancements
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)
40
+
41
+ * bug fix
42
+ * OmniAuth error message now shows the proper option (:strategy_class instead of :klass)
43
+
1
44
  == 1.5.1
2
45
 
3
46
  * bug fix
@@ -8,10 +51,10 @@
8
51
  * enhancements
9
52
  * Timeoutable also skips tracking if skip_trackable is given
10
53
  * devise_for now accepts :failure_app as an option
11
- * Models can select the proper mailer via devise_mailer method (by github.com/locomotivecms)
12
- * Migration generator now uses the change method (by github.com/nashby)
13
- * Support to markerb templates on the mailer generator (by github.com/sbounmy)
14
- * 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)
15
58
 
16
59
  * bug fix
17
60
  * Allow idempotent API requests
@@ -54,7 +97,7 @@
54
97
 
55
98
  * bug fix
56
99
  * Failure app tries the root path if a session one does not exist
57
- * 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)
58
101
  * Reset password shows proper message if user is not active
59
102
  * `clean_up_passwords` sets the accessors to nil to skip validations
60
103
 
@@ -89,7 +132,7 @@
89
132
  * enhancements
90
133
  * Add :defaults and :format support on router
91
134
  * Add simple form generators
92
- * Better localization for devise_error_messages! (by github.com/zedtux)
135
+ * Better localization for devise_error_messages! (by @zedtux)
93
136
 
94
137
  * bug fix
95
138
  * Ensure to_xml is properly white listened
@@ -98,20 +141,20 @@
98
141
  == 1.4.0
99
142
 
100
143
  * enhancements
101
- * Added authenticated and unauthenticated to the router to route the used based on his status (by github.com/sj26)
102
- * Improve e-mail regexp (by github.com/rodrigoflores)
103
- * Add strip_whitespace_keys and default to e-mail (by github.com/swrobel)
104
- * Do not run format and uniqueness validations on e-mail if it hasn't changed (by github.com/Thibaut)
105
- * Added update_without_password to update models but not allowing the password to change (by github.com/fschwahn)
106
- * 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)
107
150
 
108
151
  * bug fix
109
152
  * password_required? should not affect length validation
110
153
  * User cannot access sign up and similar pages if he is already signed in through a cookie or token
111
- * Do not convert booleans to strings on finders (by github.com/xavier)
112
- * Run validations even if current_password fails (by github.com/crx)
113
- * Devise now honors routes constraints (by github.com/macmartine)
114
- * 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)
115
158
 
116
159
  == 1.3.4
117
160
 
@@ -126,31 +169,31 @@
126
169
  == 1.3.2
127
170
 
128
171
  * bug fix
129
- * 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)
130
173
 
131
174
  == 1.3.1
132
175
 
133
176
  * enhancements
134
- * Improve failure_app responses (by github.com/indirect)
177
+ * Improve failure_app responses (by @indirect)
135
178
  * sessions/new and registrations/new also respond to xml and json now
136
179
 
137
180
  * bug fix
138
- * 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)
139
182
 
140
183
  == 1.3.0
141
184
 
142
185
  * enhancements
143
- * All controllers can now handle different mime types than html using Responders (by github.com/sikachu)
144
- * Added reset_password_within as configuration option to send the token for recovery (by github.com/jdguyot)
145
- * Bump password length to 128 characters (by github.com/k33l0r)
146
- * Add :only as option to devise_for (by github.com/timoschilling)
147
- * Allow to override path after sending password instructions (by github.com/irohiroki)
148
- * 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)
149
192
 
150
193
  * bug fix
151
194
  * Fix a bug where configuration options were being included too late
152
- * Ensure Devise::TestHelpers can be used to tests Devise internal controllers (by github.com/jwilger)
153
- * 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)
154
197
  * Calling devise more than once does not include previously added modules anymore
155
198
  * downcase_keys before validation
156
199
 
@@ -177,16 +220,16 @@
177
220
 
178
221
  * bug fix
179
222
  * Fix an issue causing infinite redirects in production
180
- * rails g destroy works properly with devise generators (by github.com/andmej)
181
- * before_failure callbacks should work on test helpers (by github.com/twinge)
182
- * rememberable cookie now is httponly by default (by github.com/JamesFerguson)
183
- * 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)
184
227
  * Ensure after_* hooks are called on RegistrationsController
185
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)
186
- * Ensure stateless token does not trigger timeout (by github.com/pixelauthority)
229
+ * Ensure stateless token does not trigger timeout (by @pixelauthority)
187
230
  * Implement handle_unverified_request for Rails 3.0.4 compatibility and improve FailureApp reliance on symbols
188
231
  * Consider namespaces while generating routes
189
- * 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)
190
233
  * Do not depend on ActiveModel::Dirty
191
234
  * Manual sign_in now triggers remember token
192
235
  * Be sure to halt strategies on failures
@@ -195,7 +238,7 @@
195
238
  * Ensure there is no Mongoid injection
196
239
 
197
240
  * deprecations
198
- * 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)
199
242
  * Removed --haml and --slim view templates
200
243
  * Devise::OmniAuth helpers were deprecated and removed in favor of Omniauth.config.test_mode
201
244
 
@@ -208,11 +251,11 @@
208
251
  * enhancements
209
252
  * Added OmniAuth support
210
253
  * Added ORM adapter to abstract ORM iteraction
211
- * sign_out_via is available in the router to configure the method used for sign out (by github.com/martinrehfeld)
212
- * 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)
213
256
  * Added request_keys to easily use request specific values (like subdomain) in authentication
214
257
  * Increased the size of friendly_token to 60 characters (reduces the chances of a successful brute attack)
215
- * 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)
216
259
  * Extracted encryptors into :encryptable for better bcrypt support
217
260
  * :rememberable is now able to use salt as token if no remember_token is provided
218
261
  * Store the salt in session and expire the session if the user changes his password
@@ -221,7 +264,7 @@
221
264
  * Sign up now check if the user is active or not and redirect him accordingly setting the inactive_signed_up message
222
265
  * Use ActiveModel#to_key instead of #id
223
266
  * sign_out_all_scopes now destroys the whole session
224
- * 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)
225
268
 
226
269
  * default behavior changes
227
270
  * sign_out_all_scopes defaults to true as security measure
@@ -230,12 +273,12 @@
230
273
 
231
274
  * bugfix
232
275
  * after_sign_in_path_for always receives a resource
233
- * Do not execute Warden::Callbacks on Devise::TestHelpers (by github.com/sgronblo)
234
- * 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)
235
278
  * FailureApp now properly handles nil request.format
236
279
  * Fix a bug causing FailureApp to return with HTTP Auth Headers for IE7
237
280
  * Ensure namespaces has proper scoped views
238
- * Ensure Devise does not set empty flash messages (by github.com/sxross)
281
+ * Ensure Devise does not set empty flash messages (by @sxross)
239
282
 
240
283
  == 1.1.6
241
284
 
@@ -260,11 +303,11 @@
260
303
 
261
304
  * bugfix
262
305
  * Add reply-to to e-mail headers by default
263
- * 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)
264
307
  * Check the type of HTTP Authentication before using Basic headers
265
- * Avoid invalid_salt errors by checking salt presence (by github.com/thibaudgg)
266
- * Forget user deletes the right cookie before logout, not remembering the user anymore (by github.com/emtrane)
267
- * 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)
268
311
  * :default options is now honored in migrations
269
312
 
270
313
  == 1.1.2
@@ -280,16 +323,16 @@
280
323
  == 1.1.0
281
324
 
282
325
  * enhancements
283
- * Rememberable module allows user to be remembered across browsers and is enabled by default (by github.com/trevorturk)
284
- * 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)
285
328
  * devise_for can now be used together with scope method in routes but with a few limitations (check the documentation)
286
329
  * Support `as` or `devise_scope` in the router to specify controller access scope
287
- * 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)
288
331
 
289
332
  * bug fix
290
333
  * Fix a bug in Devise::TestHelpers where current_user was returning a Response object for non active accounts
291
334
  * Devise should respect script_name and path_info contracts
292
- * 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)
293
336
  * Do not add unlock routes unless unlock strategy is email or both
294
337
  * Email should be case insensitive
295
338
  * Store classes as string in session, to avoid serialization and stale data issues
@@ -300,10 +343,10 @@
300
343
  == 1.1.rc2
301
344
 
302
345
  * enhancements
303
- * 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)
304
347
  * Added navigational formats to specify when it should return a 302 and when a 401.
305
- * Added authenticate(scope) support in routes (by github.com/wildchild)
306
- * 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)
307
350
  * Allow the mailer object to be replaced through config.mailer = "MyOwnMailer"
308
351
 
309
352
  * bug fix
@@ -351,10 +394,10 @@
351
394
 
352
395
  * enhancements
353
396
  * Support for latest MongoMapper
354
- * Added anybody_signed_in? helper (by github.com/SSDany)
397
+ * Added anybody_signed_in? helper (by @SSDany)
355
398
 
356
399
  * bug fix
357
- * confirmation_required? is properly honored on active? calls. (by github.com/paulrosania)
400
+ * confirmation_required? is properly honored on active? calls. (by @paulrosania)
358
401
 
359
402
  == 1.0.7
360
403
 
@@ -395,7 +438,7 @@
395
438
  == 1.0.2
396
439
 
397
440
  * enhancements
398
- * Allows you set mailer content type (by github.com/glennr)
441
+ * Allows you set mailer content type (by @glennr)
399
442
 
400
443
  * bug fix
401
444
  * Uses the same content type as request on http authenticatable 401 responses
@@ -428,12 +471,12 @@
428
471
 
429
472
  * enhancements
430
473
  * Added gemspec to repo
431
- * Added token authenticatable (by github.com/grimen)
474
+ * Added token authenticatable (by @grimen)
432
475
 
433
476
  == 0.9.1
434
477
 
435
478
  * bug fix
436
- * Allow bigger salt size (by github.com/jgeiger)
479
+ * Allow bigger salt size (by @jgeiger)
437
480
  * Fix relative url root
438
481
 
439
482
  == 0.9.0
@@ -443,11 +486,11 @@
443
486
  * :success and :failure flash messages are now :notice and :alert
444
487
 
445
488
  * enhancements
446
- * Added devise lockable (by github.com/mhfs)
489
+ * Added devise lockable (by @mhfs)
447
490
  * Warden 0.9.0 compatibility
448
491
  * Mongomapper 0.6.10 compatibility
449
- * Added Devise.add_module as hooks for extensions (by github.com/grimen)
450
- * 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)
451
494
 
452
495
  * bug fix
453
496
  * Accept path prefix not starting with slash
@@ -456,10 +499,10 @@
456
499
  == 0.8.2
457
500
 
458
501
  * enhancements
459
- * Allow Devise.mailer_sender to be a proc (by github.com/grimen)
502
+ * Allow Devise.mailer_sender to be a proc (by @grimen)
460
503
 
461
504
  * bug fix
462
- * 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)
463
506
 
464
507
  == 0.8.1
465
508
 
@@ -476,11 +519,11 @@
476
519
  * enhancements
477
520
  * Warden 0.8.0 compatibility
478
521
  * Add an easy for map.connect "sign_in", :controller => "sessions", :action => "new" to work
479
- * Added :bcrypt encryptor (by github.com/capotej)
522
+ * Added :bcrypt encryptor (by @capotej)
480
523
 
481
524
  * bug fix
482
525
  * sign_in_count is also increased when user signs in via password change, confirmation, etc..
483
- * More DataMapper compatibility (by github.com/lancecarlson)
526
+ * More DataMapper compatibility (by @lancecarlson)
484
527
 
485
528
  * deprecation
486
529
  * Removed DeviseMailer.sender
@@ -520,7 +563,7 @@
520
563
  == 0.7.1
521
564
 
522
565
  * enhancements
523
- * Small enhancements for other plugins compatibility (by github.com/grimen)
566
+ * Small enhancements for other plugins compatibility (by @grimen)
524
567
 
525
568
  == 0.7.0
526
569
 
@@ -614,9 +657,9 @@
614
657
  * Fixed a bug where remember me module was not working properly
615
658
 
616
659
  * enhancements
617
- * Moved encryption strategy into the Encryptors module to allow several algorithms (by github.com/mhfs)
618
- * Implemented encryptors for Clearance, Authlogic and Restful-Authentication (by github.com/mhfs)
619
- * 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)
620
663
 
621
664
  == 0.4.3
622
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]
@@ -72,7 +74,7 @@ We hope that you will consider contributing to Devise. Please read this short ov
72
74
 
73
75
  https://github.com/plataformatec/devise/wiki/Contributing
74
76
 
75
- You will usually want to write tests for your changes. To run the test suite, `cd` into Devise's top-level directory and run `bundle install` and `rake`. For the tests to pass, you will need to have a MongoDB server (version 1.6 or newer) running on your system.
77
+ You will usually want to write tests for your changes. To run the test suite, `cd` into Devise's top-level directory and run `bundle install` and `rake`. For the tests to pass, you will need to have a MongoDB server (version 2.0 or newer) running on your system.
76
78
 
77
79
  == Installation
78
80
 
@@ -88,7 +90,7 @@ The generator will install an initializer which describes ALL Devise's configura
88
90
 
89
91
  rails generate devise MODEL
90
92
 
91
- Replace MODEL by the class name used for the applications users, it's frequently 'User' but could also be 'Admin'. This will create a model (if one does not exist) and configure it with default Devise modules. Next, you'll usually run db:migrate as the generator will have created a migration file (if your ORM supports them). This generator also configures your config/routes.rb file, continue reading this file to understand exactly what the generator produces and how to use it.
93
+ Replace MODEL by the class name used for the applications users, it's frequently 'User' but could also be 'Admin'. This will create a model (if one does not exist) and configure it with default Devise modules. Next, you'll usually run db:migrate as the generator will have created a migration file (if your ORM supports them). This generator also configures your config/routes.rb file, continue reading this file to understand exactly what the generator produces and how to use it. Finally, if your server was already running, then restart it as Rails doesn't automatically load methods from a new gem.
92
94
 
93
95
  Support for Rails 2.3.x can be found by installing Devise 1.0.x from the v1.0 branch.
94
96
 
@@ -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
 
@@ -359,7 +361,8 @@ https://github.com/plataformatec/devise/contributors
359
361
 
360
362
  * José Valim (https://github.com/josevalim)
361
363
  * Carlos Antônio da Silva (https://github.com/carlosantoniodasilva)
364
+ * Rodrigo Flores (https://github.com/rodrigoflores)
362
365
 
363
366
  == License
364
367
 
365
- 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