devise 3.1.2 → 3.2.0

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of devise might be problematic. Click here for more details.

Files changed (62) hide show
  1. data/CHANGELOG.md +111 -99
  2. data/Gemfile.lock +1 -1
  3. data/README.md +2 -2
  4. data/app/controllers/devise/confirmations_controller.rb +2 -9
  5. data/app/controllers/devise/passwords_controller.rb +1 -1
  6. data/app/controllers/devise/registrations_controller.rb +6 -6
  7. data/app/controllers/devise/sessions_controller.rb +3 -3
  8. data/app/controllers/devise/unlocks_controller.rb +1 -1
  9. data/app/controllers/devise_controller.rb +6 -2
  10. data/app/mailers/devise/mailer.rb +15 -13
  11. data/config/locales/en.yml +1 -2
  12. data/gemfiles/Gemfile.rails-3.2.x.lock +1 -1
  13. data/lib/devise.rb +23 -12
  14. data/lib/devise/controllers/helpers.rb +16 -84
  15. data/lib/devise/controllers/rememberable.rb +2 -12
  16. data/lib/devise/controllers/sign_in_out.rb +103 -0
  17. data/lib/devise/failure_app.rb +11 -2
  18. data/lib/devise/hooks/forgetable.rb +1 -1
  19. data/lib/devise/hooks/proxy.rb +21 -0
  20. data/lib/devise/hooks/rememberable.rb +1 -1
  21. data/lib/devise/hooks/timeoutable.rb +4 -1
  22. data/lib/devise/models.rb +0 -5
  23. data/lib/devise/models/authenticatable.rb +8 -9
  24. data/lib/devise/models/confirmable.rb +0 -4
  25. data/lib/devise/models/database_authenticatable.rb +17 -7
  26. data/lib/devise/models/lockable.rb +6 -4
  27. data/lib/devise/models/recoverable.rb +0 -8
  28. data/lib/devise/modules.rb +0 -1
  29. data/lib/devise/rails/routes.rb +29 -15
  30. data/lib/devise/strategies/database_authenticatable.rb +3 -6
  31. data/lib/devise/test_helpers.rb +1 -0
  32. data/lib/devise/version.rb +1 -1
  33. data/lib/generators/mongoid/devise_generator.rb +0 -3
  34. data/lib/generators/templates/devise.rb +6 -10
  35. data/lib/generators/templates/markerb/confirmation_instructions.markerb +1 -1
  36. data/lib/generators/templates/markerb/reset_password_instructions.markerb +1 -1
  37. data/lib/generators/templates/markerb/unlock_instructions.markerb +1 -1
  38. data/test/controllers/internal_helpers_test.rb +2 -2
  39. data/test/controllers/sessions_controller_test.rb +1 -1
  40. data/test/devise_test.rb +12 -1
  41. data/test/failure_app_test.rb +11 -0
  42. data/test/integration/confirmable_test.rb +0 -12
  43. data/test/integration/http_authenticatable_test.rb +0 -10
  44. data/test/integration/recoverable_test.rb +2 -2
  45. data/test/integration/rememberable_test.rb +3 -3
  46. data/test/integration/timeoutable_test.rb +28 -0
  47. data/test/mapping_test.rb +2 -2
  48. data/test/models/confirmable_test.rb +0 -9
  49. data/test/models/database_authenticatable_test.rb +19 -1
  50. data/test/models/lockable_test.rb +16 -10
  51. data/test/models/recoverable_test.rb +0 -10
  52. data/test/rails_app/app/mongoid/user.rb +0 -3
  53. data/test/rails_app/db/migrate/20100401102949_create_tables.rb +0 -3
  54. data/test/rails_app/db/schema.rb +0 -1
  55. data/test/rails_app/lib/shared_user.rb +1 -1
  56. data/test/support/locale/en.yml +4 -0
  57. data/test/test_helpers_test.rb +22 -0
  58. metadata +4 -8
  59. data/lib/devise/models/token_authenticatable.rb +0 -92
  60. data/lib/devise/strategies/token_authenticatable.rb +0 -91
  61. data/test/integration/token_authenticatable_test.rb +0 -205
  62. data/test/models/token_authenticatable_test.rb +0 -55
@@ -1,55 +0,0 @@
1
- require 'test_helper'
2
-
3
- class TokenAuthenticatableTest < ActiveSupport::TestCase
4
-
5
- test 'should reset authentication token' do
6
- user = new_user
7
- user.reset_authentication_token
8
- previous_token = user.authentication_token
9
- user.reset_authentication_token
10
- assert_not_equal previous_token, user.authentication_token
11
- end
12
-
13
- test 'should ensure authentication token' do
14
- user = new_user
15
- user.ensure_authentication_token
16
- previous_token = user.authentication_token
17
- user.ensure_authentication_token
18
- assert_equal previous_token, user.authentication_token
19
- end
20
-
21
- test 'should authenticate a valid user with authentication token and return it' do
22
- user = create_user
23
- user.ensure_authentication_token!
24
- user.confirm!
25
- authenticated_user = User.find_for_token_authentication(:auth_token => user.authentication_token)
26
- assert_equal authenticated_user, user
27
- end
28
-
29
- test 'should return nil when authenticating an invalid user by authentication token' do
30
- user = create_user
31
- user.ensure_authentication_token!
32
- user.confirm!
33
- authenticated_user = User.find_for_token_authentication(:auth_token => user.authentication_token.reverse)
34
- assert_nil authenticated_user
35
- end
36
-
37
- test 'should not be subject to injection' do
38
- user1 = create_user
39
- user1.ensure_authentication_token!
40
- user1.confirm!
41
-
42
- user2 = create_user
43
- user2.ensure_authentication_token!
44
- user2.confirm!
45
-
46
- user = User.find_for_token_authentication(:auth_token => {'$ne' => user1.authentication_token})
47
- assert_nil user
48
- end
49
-
50
- test 'required_fields should contain the fields that Devise uses' do
51
- assert_same_content Devise::Models::TokenAuthenticatable.required_fields(User), [
52
- :authentication_token
53
- ]
54
- end
55
- end