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.
- data/CHANGELOG.md +111 -99
- data/Gemfile.lock +1 -1
- data/README.md +2 -2
- data/app/controllers/devise/confirmations_controller.rb +2 -9
- data/app/controllers/devise/passwords_controller.rb +1 -1
- data/app/controllers/devise/registrations_controller.rb +6 -6
- data/app/controllers/devise/sessions_controller.rb +3 -3
- data/app/controllers/devise/unlocks_controller.rb +1 -1
- data/app/controllers/devise_controller.rb +6 -2
- data/app/mailers/devise/mailer.rb +15 -13
- data/config/locales/en.yml +1 -2
- data/gemfiles/Gemfile.rails-3.2.x.lock +1 -1
- data/lib/devise.rb +23 -12
- data/lib/devise/controllers/helpers.rb +16 -84
- data/lib/devise/controllers/rememberable.rb +2 -12
- data/lib/devise/controllers/sign_in_out.rb +103 -0
- data/lib/devise/failure_app.rb +11 -2
- data/lib/devise/hooks/forgetable.rb +1 -1
- data/lib/devise/hooks/proxy.rb +21 -0
- data/lib/devise/hooks/rememberable.rb +1 -1
- data/lib/devise/hooks/timeoutable.rb +4 -1
- data/lib/devise/models.rb +0 -5
- data/lib/devise/models/authenticatable.rb +8 -9
- data/lib/devise/models/confirmable.rb +0 -4
- data/lib/devise/models/database_authenticatable.rb +17 -7
- data/lib/devise/models/lockable.rb +6 -4
- data/lib/devise/models/recoverable.rb +0 -8
- data/lib/devise/modules.rb +0 -1
- data/lib/devise/rails/routes.rb +29 -15
- data/lib/devise/strategies/database_authenticatable.rb +3 -6
- data/lib/devise/test_helpers.rb +1 -0
- data/lib/devise/version.rb +1 -1
- data/lib/generators/mongoid/devise_generator.rb +0 -3
- data/lib/generators/templates/devise.rb +6 -10
- data/lib/generators/templates/markerb/confirmation_instructions.markerb +1 -1
- data/lib/generators/templates/markerb/reset_password_instructions.markerb +1 -1
- data/lib/generators/templates/markerb/unlock_instructions.markerb +1 -1
- data/test/controllers/internal_helpers_test.rb +2 -2
- data/test/controllers/sessions_controller_test.rb +1 -1
- data/test/devise_test.rb +12 -1
- data/test/failure_app_test.rb +11 -0
- data/test/integration/confirmable_test.rb +0 -12
- data/test/integration/http_authenticatable_test.rb +0 -10
- data/test/integration/recoverable_test.rb +2 -2
- data/test/integration/rememberable_test.rb +3 -3
- data/test/integration/timeoutable_test.rb +28 -0
- data/test/mapping_test.rb +2 -2
- data/test/models/confirmable_test.rb +0 -9
- data/test/models/database_authenticatable_test.rb +19 -1
- data/test/models/lockable_test.rb +16 -10
- data/test/models/recoverable_test.rb +0 -10
- data/test/rails_app/app/mongoid/user.rb +0 -3
- data/test/rails_app/db/migrate/20100401102949_create_tables.rb +0 -3
- data/test/rails_app/db/schema.rb +0 -1
- data/test/rails_app/lib/shared_user.rb +1 -1
- data/test/support/locale/en.yml +4 -0
- data/test/test_helpers_test.rb +22 -0
- metadata +4 -8
- data/lib/devise/models/token_authenticatable.rb +0 -92
- data/lib/devise/strategies/token_authenticatable.rb +0 -91
- data/test/integration/token_authenticatable_test.rb +0 -205
- 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
|