devise 1.0.11 → 1.1.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.
- data/CHANGELOG.rdoc +59 -13
- data/Gemfile +23 -0
- data/Gemfile.lock +118 -0
- data/README.rdoc +116 -77
- data/Rakefile +4 -2
- data/TODO +3 -2
- data/app/controllers/{confirmations_controller.rb → devise/confirmations_controller.rb} +1 -1
- data/app/controllers/{passwords_controller.rb → devise/passwords_controller.rb} +1 -1
- data/app/controllers/{registrations_controller.rb → devise/registrations_controller.rb} +12 -8
- data/app/controllers/devise/sessions_controller.rb +23 -0
- data/app/controllers/{unlocks_controller.rb → devise/unlocks_controller.rb} +1 -8
- data/app/helpers/devise_helper.rb +17 -0
- data/app/mailers/devise/mailer.rb +71 -0
- data/app/views/devise/confirmations/new.html.erb +12 -0
- data/app/views/devise/passwords/edit.html.erb +16 -0
- data/app/views/devise/passwords/new.html.erb +12 -0
- data/app/views/devise/registrations/edit.html.erb +25 -0
- data/app/views/devise/registrations/new.html.erb +18 -0
- data/app/views/devise/sessions/new.html.erb +17 -0
- data/app/views/devise/shared/_links.erb +19 -0
- data/app/views/devise/unlocks/new.html.erb +12 -0
- data/{lib/devise → config}/locales/en.yml +16 -12
- data/lib/devise/controllers/helpers.rb +57 -52
- data/lib/devise/controllers/internal_helpers.rb +19 -50
- data/lib/devise/controllers/scoped_views.rb +35 -0
- data/lib/devise/controllers/url_helpers.rb +1 -1
- data/lib/devise/encryptors/authlogic_sha512.rb +0 -2
- data/lib/devise/encryptors/base.rb +1 -1
- data/lib/devise/encryptors/bcrypt.rb +2 -4
- data/lib/devise/encryptors/clearance_sha1.rb +0 -2
- data/lib/devise/encryptors/sha1.rb +6 -8
- data/lib/devise/encryptors/sha512.rb +6 -8
- data/lib/devise/failure_app.rb +76 -41
- data/lib/devise/hooks/activatable.rb +6 -10
- data/lib/devise/hooks/forgetable.rb +11 -0
- data/lib/devise/hooks/rememberable.rb +40 -30
- data/lib/devise/hooks/timeoutable.rb +7 -3
- data/lib/devise/hooks/trackable.rb +5 -14
- data/lib/devise/mapping.rb +35 -62
- data/lib/devise/models/authenticatable.rb +126 -0
- data/lib/devise/models/confirmable.rb +19 -22
- data/lib/devise/models/database_authenticatable.rb +26 -60
- data/lib/devise/models/lockable.rb +43 -28
- data/lib/devise/models/recoverable.rb +11 -10
- data/lib/devise/models/rememberable.rb +56 -26
- data/lib/devise/models/timeoutable.rb +1 -3
- data/lib/devise/models/token_authenticatable.rb +14 -43
- data/lib/devise/models/trackable.rb +14 -0
- data/lib/devise/models/validatable.rb +16 -2
- data/lib/devise/models.rb +16 -53
- data/lib/devise/modules.rb +23 -0
- data/lib/devise/orm/active_record.rb +10 -15
- data/lib/devise/orm/mongoid.rb +29 -0
- data/lib/devise/path_checker.rb +18 -0
- data/lib/devise/rails/routes.rb +232 -117
- data/lib/devise/rails/warden_compat.rb +17 -41
- data/lib/devise/rails.rb +64 -9
- data/lib/devise/schema.rb +47 -23
- data/lib/devise/strategies/authenticatable.rb +123 -0
- data/lib/devise/strategies/base.rb +2 -3
- data/lib/devise/strategies/database_authenticatable.rb +7 -22
- data/lib/devise/strategies/rememberable.rb +21 -7
- data/lib/devise/strategies/token_authenticatable.rb +31 -19
- data/lib/devise/test_helpers.rb +6 -6
- data/lib/devise/version.rb +1 -1
- data/lib/devise.rb +174 -157
- data/lib/generators/active_record/devise_generator.rb +28 -0
- data/{generators/devise → lib/generators/active_record}/templates/migration.rb +9 -3
- data/lib/generators/devise/devise_generator.rb +17 -0
- data/lib/generators/devise/install_generator.rb +24 -0
- data/lib/generators/devise/orm_helpers.rb +23 -0
- data/{generators/devise_install → lib/generators/devise}/templates/README +9 -7
- data/lib/generators/devise/templates/devise.rb +142 -0
- data/lib/generators/devise/views_generator.rb +63 -0
- data/lib/generators/devise_install_generator.rb +4 -0
- data/lib/generators/devise_views_generator.rb +4 -0
- data/lib/generators/mongoid/devise_generator.rb +17 -0
- data/test/controllers/helpers_test.rb +48 -19
- data/test/controllers/internal_helpers_test.rb +12 -16
- data/test/controllers/url_helpers_test.rb +21 -10
- data/test/devise_test.rb +16 -25
- data/test/encryptors_test.rb +2 -3
- data/test/failure_app_test.rb +106 -27
- data/test/integration/authenticatable_test.rb +135 -131
- data/test/integration/confirmable_test.rb +22 -15
- data/test/integration/database_authenticatable_test.rb +38 -0
- data/test/integration/http_authenticatable_test.rb +9 -12
- data/test/integration/lockable_test.rb +22 -15
- data/test/integration/recoverable_test.rb +6 -6
- data/test/integration/registerable_test.rb +42 -33
- data/test/integration/rememberable_test.rb +84 -22
- data/test/integration/timeoutable_test.rb +16 -4
- data/test/integration/token_authenticatable_test.rb +45 -12
- data/test/integration/trackable_test.rb +1 -1
- data/test/mailers/confirmation_instructions_test.rb +11 -17
- data/test/mailers/reset_password_instructions_test.rb +7 -7
- data/test/mailers/unlock_instructions_test.rb +7 -7
- data/test/mapping_test.rb +22 -95
- data/test/models/confirmable_test.rb +12 -19
- data/test/models/{authenticatable_test.rb → database_authenticatable_test.rb} +24 -56
- data/test/models/lockable_test.rb +32 -46
- data/test/models/recoverable_test.rb +7 -7
- data/test/models/rememberable_test.rb +118 -35
- data/test/models/timeoutable_test.rb +1 -1
- data/test/models/token_authenticatable_test.rb +5 -19
- data/test/models/trackable_test.rb +1 -1
- data/test/models/validatable_test.rb +20 -27
- data/test/models_test.rb +12 -5
- data/test/orm/active_record.rb +1 -23
- data/test/orm/mongoid.rb +10 -0
- data/test/rails_app/app/active_record/admin.rb +1 -5
- data/test/rails_app/app/active_record/shim.rb +2 -0
- data/test/rails_app/app/active_record/user.rb +3 -3
- data/test/rails_app/app/controllers/application_controller.rb +2 -5
- data/test/rails_app/app/controllers/home_controller.rb +3 -0
- data/test/rails_app/app/controllers/publisher/registrations_controller.rb +2 -0
- data/test/rails_app/app/controllers/publisher/sessions_controller.rb +2 -0
- data/test/rails_app/app/controllers/sessions_controller.rb +6 -0
- data/test/rails_app/app/controllers/users_controller.rb +7 -5
- data/test/rails_app/app/mongoid/admin.rb +6 -0
- data/test/rails_app/app/mongoid/shim.rb +16 -0
- data/test/rails_app/app/mongoid/user.rb +10 -0
- data/test/rails_app/config/application.rb +35 -0
- data/test/rails_app/config/boot.rb +10 -107
- data/test/rails_app/config/environment.rb +4 -41
- data/test/rails_app/config/environments/development.rb +15 -13
- data/test/rails_app/config/environments/production.rb +25 -20
- data/test/rails_app/config/environments/test.rb +33 -28
- data/test/rails_app/config/initializers/backtrace_silencers.rb +7 -0
- data/test/rails_app/config/initializers/devise.rb +95 -38
- data/test/rails_app/config/initializers/secret_token.rb +2 -0
- data/test/rails_app/config/routes.rb +47 -25
- data/test/rails_app/db/migrate/20100401102949_create_tables.rb +27 -0
- data/test/rails_app/db/schema.rb +86 -0
- data/test/routes_test.rb +62 -47
- data/test/support/{assertions_helper.rb → assertions.rb} +2 -15
- data/test/support/{tests_helper.rb → helpers.rb} +18 -3
- data/test/support/{integration_tests_helper.rb → integration.rb} +24 -7
- data/test/support/webrat/integrations/rails.rb +32 -0
- data/test/test_helper.rb +11 -11
- data/test/test_helpers_test.rb +30 -15
- metadata +107 -66
- data/app/controllers/sessions_controller.rb +0 -42
- data/app/models/devise_mailer.rb +0 -68
- data/app/views/confirmations/new.html.erb +0 -12
- data/app/views/passwords/edit.html.erb +0 -16
- data/app/views/passwords/new.html.erb +0 -12
- data/app/views/registrations/edit.html.erb +0 -25
- data/app/views/registrations/new.html.erb +0 -17
- data/app/views/sessions/new.html.erb +0 -17
- data/app/views/shared/_devise_links.erb +0 -19
- data/app/views/unlocks/new.html.erb +0 -12
- data/generators/devise/USAGE +0 -5
- data/generators/devise/devise_generator.rb +0 -15
- data/generators/devise/lib/route_devise.rb +0 -32
- data/generators/devise/templates/model.rb +0 -9
- data/generators/devise_install/USAGE +0 -3
- data/generators/devise_install/devise_install_generator.rb +0 -15
- data/generators/devise_install/templates/devise.rb +0 -105
- data/generators/devise_views/USAGE +0 -3
- data/generators/devise_views/devise_views_generator.rb +0 -21
- data/lib/devise/models/activatable.rb +0 -16
- data/lib/devise/models/http_authenticatable.rb +0 -23
- data/lib/devise/orm/data_mapper.rb +0 -83
- data/lib/devise/orm/mongo_mapper.rb +0 -52
- data/lib/devise/strategies/http_authenticatable.rb +0 -59
- data/rails/init.rb +0 -2
- data/test/integration/rack_middleware_test.rb +0 -47
- data/test/orm/mongo_mapper.rb +0 -20
- data/test/rails_app/app/mongo_mapper/admin.rb +0 -13
- data/test/rails_app/app/mongo_mapper/user.rb +0 -14
- data/test/rails_app/config/initializers/new_rails_defaults.rb +0 -24
- data/test/rails_app/config/initializers/session_store.rb +0 -15
- /data/app/views/{devise_mailer → devise/mailer}/confirmation_instructions.html.erb +0 -0
- /data/app/views/{devise_mailer → devise/mailer}/reset_password_instructions.html.erb +0 -0
- /data/app/views/{devise_mailer → devise/mailer}/unlock_instructions.html.erb +0 -0
data/test/test_helpers_test.rb
CHANGED
|
@@ -1,19 +1,34 @@
|
|
|
1
|
-
require '
|
|
1
|
+
require 'test_helper'
|
|
2
2
|
|
|
3
3
|
class TestHelpersTest < ActionController::TestCase
|
|
4
4
|
tests UsersController
|
|
5
5
|
include Devise::TestHelpers
|
|
6
6
|
|
|
7
7
|
test "redirects if attempting to access a page unauthenticated" do
|
|
8
|
-
get :
|
|
9
|
-
assert_redirected_to
|
|
8
|
+
get :index
|
|
9
|
+
assert_redirected_to new_user_session_path
|
|
10
|
+
assert_equal "You need to sign in or sign up before continuing.", flash[:alert]
|
|
10
11
|
end
|
|
11
12
|
|
|
12
|
-
test "redirects if attempting to access a page with
|
|
13
|
+
test "redirects if attempting to access a page with an unconfirmed account" do
|
|
13
14
|
swap Devise, :confirm_within => 0 do
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
15
|
+
user = create_user
|
|
16
|
+
assert !user.active?
|
|
17
|
+
|
|
18
|
+
sign_in user
|
|
19
|
+
get :index
|
|
20
|
+
assert_redirected_to new_user_session_path
|
|
21
|
+
end
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
test "returns nil if accessing current_user with an unconfirmed account" do
|
|
25
|
+
swap Devise, :confirm_within => 0 do
|
|
26
|
+
user = create_user
|
|
27
|
+
assert !user.active?
|
|
28
|
+
|
|
29
|
+
sign_in user
|
|
30
|
+
get :accept, :id => user
|
|
31
|
+
assert_nil assigns(:current_user)
|
|
17
32
|
end
|
|
18
33
|
end
|
|
19
34
|
|
|
@@ -22,7 +37,7 @@ class TestHelpersTest < ActionController::TestCase
|
|
|
22
37
|
user.confirm!
|
|
23
38
|
|
|
24
39
|
sign_in user
|
|
25
|
-
get :
|
|
40
|
+
get :index
|
|
26
41
|
assert_response :success
|
|
27
42
|
end
|
|
28
43
|
|
|
@@ -31,11 +46,11 @@ class TestHelpersTest < ActionController::TestCase
|
|
|
31
46
|
user.confirm!
|
|
32
47
|
|
|
33
48
|
sign_in user
|
|
34
|
-
get :
|
|
49
|
+
get :index
|
|
35
50
|
|
|
36
51
|
sign_out user
|
|
37
|
-
get :
|
|
38
|
-
assert_redirected_to
|
|
52
|
+
get :index
|
|
53
|
+
assert_redirected_to new_user_session_path
|
|
39
54
|
end
|
|
40
55
|
|
|
41
56
|
test "allows to sign in with different users" do
|
|
@@ -43,15 +58,15 @@ class TestHelpersTest < ActionController::TestCase
|
|
|
43
58
|
first_user.confirm!
|
|
44
59
|
|
|
45
60
|
sign_in first_user
|
|
46
|
-
get :
|
|
47
|
-
|
|
61
|
+
get :index
|
|
62
|
+
assert_match /User ##{first_user.id}/, @response.body
|
|
48
63
|
sign_out first_user
|
|
49
64
|
|
|
50
65
|
second_user = create_user
|
|
51
66
|
second_user.confirm!
|
|
52
67
|
|
|
53
68
|
sign_in second_user
|
|
54
|
-
get :
|
|
55
|
-
|
|
69
|
+
get :index
|
|
70
|
+
assert_match /User ##{second_user.id}/, @response.body
|
|
56
71
|
end
|
|
57
72
|
end
|
metadata
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: devise
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
hash:
|
|
5
|
-
prerelease:
|
|
4
|
+
hash: 19
|
|
5
|
+
prerelease: false
|
|
6
6
|
segments:
|
|
7
7
|
- 1
|
|
8
|
+
- 1
|
|
8
9
|
- 0
|
|
9
|
-
|
|
10
|
-
version: 1.0.11
|
|
10
|
+
version: 1.1.0
|
|
11
11
|
platform: ruby
|
|
12
12
|
authors:
|
|
13
13
|
- "Jos\xC3\xA9 Valim"
|
|
@@ -16,7 +16,7 @@ autorequire:
|
|
|
16
16
|
bindir: bin
|
|
17
17
|
cert_chain: []
|
|
18
18
|
|
|
19
|
-
date:
|
|
19
|
+
date: 2010-07-26 00:00:00 +02:00
|
|
20
20
|
default_executable:
|
|
21
21
|
dependencies:
|
|
22
22
|
- !ruby/object:Gem::Dependency
|
|
@@ -27,14 +27,30 @@ dependencies:
|
|
|
27
27
|
requirements:
|
|
28
28
|
- - ~>
|
|
29
29
|
- !ruby/object:Gem::Version
|
|
30
|
-
hash:
|
|
30
|
+
hash: 57
|
|
31
31
|
segments:
|
|
32
32
|
- 0
|
|
33
33
|
- 10
|
|
34
|
-
-
|
|
35
|
-
version: 0.10.
|
|
34
|
+
- 7
|
|
35
|
+
version: 0.10.7
|
|
36
36
|
type: :runtime
|
|
37
37
|
version_requirements: *id001
|
|
38
|
+
- !ruby/object:Gem::Dependency
|
|
39
|
+
name: bcrypt-ruby
|
|
40
|
+
prerelease: false
|
|
41
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
|
42
|
+
none: false
|
|
43
|
+
requirements:
|
|
44
|
+
- - ~>
|
|
45
|
+
- !ruby/object:Gem::Version
|
|
46
|
+
hash: 15
|
|
47
|
+
segments:
|
|
48
|
+
- 2
|
|
49
|
+
- 1
|
|
50
|
+
- 2
|
|
51
|
+
version: 2.1.2
|
|
52
|
+
type: :runtime
|
|
53
|
+
version_requirements: *id002
|
|
38
54
|
description: Flexible authentication solution for Rails with Warden
|
|
39
55
|
email: contact@plataformatec.com.br
|
|
40
56
|
executables: []
|
|
@@ -42,45 +58,42 @@ executables: []
|
|
|
42
58
|
extensions: []
|
|
43
59
|
|
|
44
60
|
extra_rdoc_files:
|
|
61
|
+
- CHANGELOG.rdoc
|
|
62
|
+
- Gemfile.lock
|
|
63
|
+
- MIT-LICENSE
|
|
45
64
|
- README.rdoc
|
|
46
65
|
- TODO
|
|
47
66
|
files:
|
|
48
67
|
- CHANGELOG.rdoc
|
|
68
|
+
- Gemfile
|
|
69
|
+
- Gemfile.lock
|
|
49
70
|
- MIT-LICENSE
|
|
50
71
|
- README.rdoc
|
|
51
72
|
- Rakefile
|
|
52
73
|
- TODO
|
|
53
|
-
- app/controllers/confirmations_controller.rb
|
|
54
|
-
- app/controllers/passwords_controller.rb
|
|
55
|
-
- app/controllers/registrations_controller.rb
|
|
56
|
-
- app/controllers/sessions_controller.rb
|
|
57
|
-
- app/controllers/unlocks_controller.rb
|
|
58
|
-
- app/
|
|
59
|
-
- app/
|
|
60
|
-
- app/views/
|
|
61
|
-
- app/views/
|
|
62
|
-
- app/views/
|
|
63
|
-
- app/views/
|
|
64
|
-
- app/views/passwords/
|
|
65
|
-
- app/views/
|
|
66
|
-
- app/views/registrations/
|
|
67
|
-
- app/views/
|
|
68
|
-
- app/views/
|
|
69
|
-
- app/views/
|
|
70
|
-
-
|
|
71
|
-
-
|
|
72
|
-
- generators/devise/lib/route_devise.rb
|
|
73
|
-
- generators/devise/templates/migration.rb
|
|
74
|
-
- generators/devise/templates/model.rb
|
|
75
|
-
- generators/devise_install/USAGE
|
|
76
|
-
- generators/devise_install/devise_install_generator.rb
|
|
77
|
-
- generators/devise_install/templates/README
|
|
78
|
-
- generators/devise_install/templates/devise.rb
|
|
79
|
-
- generators/devise_views/USAGE
|
|
80
|
-
- generators/devise_views/devise_views_generator.rb
|
|
74
|
+
- app/controllers/devise/confirmations_controller.rb
|
|
75
|
+
- app/controllers/devise/passwords_controller.rb
|
|
76
|
+
- app/controllers/devise/registrations_controller.rb
|
|
77
|
+
- app/controllers/devise/sessions_controller.rb
|
|
78
|
+
- app/controllers/devise/unlocks_controller.rb
|
|
79
|
+
- app/helpers/devise_helper.rb
|
|
80
|
+
- app/mailers/devise/mailer.rb
|
|
81
|
+
- app/views/devise/confirmations/new.html.erb
|
|
82
|
+
- app/views/devise/mailer/confirmation_instructions.html.erb
|
|
83
|
+
- app/views/devise/mailer/reset_password_instructions.html.erb
|
|
84
|
+
- app/views/devise/mailer/unlock_instructions.html.erb
|
|
85
|
+
- app/views/devise/passwords/edit.html.erb
|
|
86
|
+
- app/views/devise/passwords/new.html.erb
|
|
87
|
+
- app/views/devise/registrations/edit.html.erb
|
|
88
|
+
- app/views/devise/registrations/new.html.erb
|
|
89
|
+
- app/views/devise/sessions/new.html.erb
|
|
90
|
+
- app/views/devise/shared/_links.erb
|
|
91
|
+
- app/views/devise/unlocks/new.html.erb
|
|
92
|
+
- config/locales/en.yml
|
|
81
93
|
- lib/devise.rb
|
|
82
94
|
- lib/devise/controllers/helpers.rb
|
|
83
95
|
- lib/devise/controllers/internal_helpers.rb
|
|
96
|
+
- lib/devise/controllers/scoped_views.rb
|
|
84
97
|
- lib/devise/controllers/url_helpers.rb
|
|
85
98
|
- lib/devise/encryptors/authlogic_sha512.rb
|
|
86
99
|
- lib/devise/encryptors/base.rb
|
|
@@ -91,16 +104,15 @@ files:
|
|
|
91
104
|
- lib/devise/encryptors/sha512.rb
|
|
92
105
|
- lib/devise/failure_app.rb
|
|
93
106
|
- lib/devise/hooks/activatable.rb
|
|
107
|
+
- lib/devise/hooks/forgetable.rb
|
|
94
108
|
- lib/devise/hooks/rememberable.rb
|
|
95
109
|
- lib/devise/hooks/timeoutable.rb
|
|
96
110
|
- lib/devise/hooks/trackable.rb
|
|
97
|
-
- lib/devise/locales/en.yml
|
|
98
111
|
- lib/devise/mapping.rb
|
|
99
112
|
- lib/devise/models.rb
|
|
100
|
-
- lib/devise/models/
|
|
113
|
+
- lib/devise/models/authenticatable.rb
|
|
101
114
|
- lib/devise/models/confirmable.rb
|
|
102
115
|
- lib/devise/models/database_authenticatable.rb
|
|
103
|
-
- lib/devise/models/http_authenticatable.rb
|
|
104
116
|
- lib/devise/models/lockable.rb
|
|
105
117
|
- lib/devise/models/recoverable.rb
|
|
106
118
|
- lib/devise/models/registerable.rb
|
|
@@ -109,21 +121,32 @@ files:
|
|
|
109
121
|
- lib/devise/models/token_authenticatable.rb
|
|
110
122
|
- lib/devise/models/trackable.rb
|
|
111
123
|
- lib/devise/models/validatable.rb
|
|
124
|
+
- lib/devise/modules.rb
|
|
112
125
|
- lib/devise/orm/active_record.rb
|
|
113
|
-
- lib/devise/orm/
|
|
114
|
-
- lib/devise/
|
|
126
|
+
- lib/devise/orm/mongoid.rb
|
|
127
|
+
- lib/devise/path_checker.rb
|
|
115
128
|
- lib/devise/rails.rb
|
|
116
129
|
- lib/devise/rails/routes.rb
|
|
117
130
|
- lib/devise/rails/warden_compat.rb
|
|
118
131
|
- lib/devise/schema.rb
|
|
132
|
+
- lib/devise/strategies/authenticatable.rb
|
|
119
133
|
- lib/devise/strategies/base.rb
|
|
120
134
|
- lib/devise/strategies/database_authenticatable.rb
|
|
121
|
-
- lib/devise/strategies/http_authenticatable.rb
|
|
122
135
|
- lib/devise/strategies/rememberable.rb
|
|
123
136
|
- lib/devise/strategies/token_authenticatable.rb
|
|
124
137
|
- lib/devise/test_helpers.rb
|
|
125
138
|
- lib/devise/version.rb
|
|
126
|
-
-
|
|
139
|
+
- lib/generators/active_record/devise_generator.rb
|
|
140
|
+
- lib/generators/active_record/templates/migration.rb
|
|
141
|
+
- lib/generators/devise/devise_generator.rb
|
|
142
|
+
- lib/generators/devise/install_generator.rb
|
|
143
|
+
- lib/generators/devise/orm_helpers.rb
|
|
144
|
+
- lib/generators/devise/templates/README
|
|
145
|
+
- lib/generators/devise/templates/devise.rb
|
|
146
|
+
- lib/generators/devise/views_generator.rb
|
|
147
|
+
- lib/generators/devise_install_generator.rb
|
|
148
|
+
- lib/generators/devise_views_generator.rb
|
|
149
|
+
- lib/generators/mongoid/devise_generator.rb
|
|
127
150
|
- test/controllers/helpers_test.rb
|
|
128
151
|
- test/controllers/internal_helpers_test.rb
|
|
129
152
|
- test/controllers/url_helpers_test.rb
|
|
@@ -132,9 +155,9 @@ files:
|
|
|
132
155
|
- test/failure_app_test.rb
|
|
133
156
|
- test/integration/authenticatable_test.rb
|
|
134
157
|
- test/integration/confirmable_test.rb
|
|
158
|
+
- test/integration/database_authenticatable_test.rb
|
|
135
159
|
- test/integration/http_authenticatable_test.rb
|
|
136
160
|
- test/integration/lockable_test.rb
|
|
137
|
-
- test/integration/rack_middleware_test.rb
|
|
138
161
|
- test/integration/recoverable_test.rb
|
|
139
162
|
- test/integration/registerable_test.rb
|
|
140
163
|
- test/integration/rememberable_test.rb
|
|
@@ -145,8 +168,8 @@ files:
|
|
|
145
168
|
- test/mailers/reset_password_instructions_test.rb
|
|
146
169
|
- test/mailers/unlock_instructions_test.rb
|
|
147
170
|
- test/mapping_test.rb
|
|
148
|
-
- test/models/authenticatable_test.rb
|
|
149
171
|
- test/models/confirmable_test.rb
|
|
172
|
+
- test/models/database_authenticatable_test.rb
|
|
150
173
|
- test/models/lockable_test.rb
|
|
151
174
|
- test/models/recoverable_test.rb
|
|
152
175
|
- test/models/rememberable_test.rb
|
|
@@ -156,31 +179,40 @@ files:
|
|
|
156
179
|
- test/models/validatable_test.rb
|
|
157
180
|
- test/models_test.rb
|
|
158
181
|
- test/orm/active_record.rb
|
|
159
|
-
- test/orm/
|
|
182
|
+
- test/orm/mongoid.rb
|
|
160
183
|
- test/rails_app/app/active_record/admin.rb
|
|
184
|
+
- test/rails_app/app/active_record/shim.rb
|
|
161
185
|
- test/rails_app/app/active_record/user.rb
|
|
162
186
|
- test/rails_app/app/controllers/admins_controller.rb
|
|
163
187
|
- test/rails_app/app/controllers/application_controller.rb
|
|
164
188
|
- test/rails_app/app/controllers/home_controller.rb
|
|
189
|
+
- test/rails_app/app/controllers/publisher/registrations_controller.rb
|
|
190
|
+
- test/rails_app/app/controllers/publisher/sessions_controller.rb
|
|
191
|
+
- test/rails_app/app/controllers/sessions_controller.rb
|
|
165
192
|
- test/rails_app/app/controllers/users_controller.rb
|
|
166
193
|
- test/rails_app/app/helpers/application_helper.rb
|
|
167
|
-
- test/rails_app/app/
|
|
168
|
-
- test/rails_app/app/
|
|
194
|
+
- test/rails_app/app/mongoid/admin.rb
|
|
195
|
+
- test/rails_app/app/mongoid/shim.rb
|
|
196
|
+
- test/rails_app/app/mongoid/user.rb
|
|
197
|
+
- test/rails_app/config/application.rb
|
|
169
198
|
- test/rails_app/config/boot.rb
|
|
170
199
|
- test/rails_app/config/environment.rb
|
|
171
200
|
- test/rails_app/config/environments/development.rb
|
|
172
201
|
- test/rails_app/config/environments/production.rb
|
|
173
202
|
- test/rails_app/config/environments/test.rb
|
|
203
|
+
- test/rails_app/config/initializers/backtrace_silencers.rb
|
|
174
204
|
- test/rails_app/config/initializers/devise.rb
|
|
175
205
|
- test/rails_app/config/initializers/inflections.rb
|
|
176
|
-
- test/rails_app/config/initializers/
|
|
177
|
-
- test/rails_app/config/initializers/session_store.rb
|
|
206
|
+
- test/rails_app/config/initializers/secret_token.rb
|
|
178
207
|
- test/rails_app/config/routes.rb
|
|
208
|
+
- test/rails_app/db/migrate/20100401102949_create_tables.rb
|
|
209
|
+
- test/rails_app/db/schema.rb
|
|
179
210
|
- test/routes_test.rb
|
|
180
|
-
- test/support/
|
|
181
|
-
- test/support/
|
|
211
|
+
- test/support/assertions.rb
|
|
212
|
+
- test/support/helpers.rb
|
|
213
|
+
- test/support/integration.rb
|
|
182
214
|
- test/support/test_silencer.rb
|
|
183
|
-
- test/support/
|
|
215
|
+
- test/support/webrat/integrations/rails.rb
|
|
184
216
|
- test/test_helper.rb
|
|
185
217
|
- test/test_helpers_test.rb
|
|
186
218
|
has_rdoc: true
|
|
@@ -188,8 +220,8 @@ homepage: http://github.com/plataformatec/devise
|
|
|
188
220
|
licenses: []
|
|
189
221
|
|
|
190
222
|
post_install_message:
|
|
191
|
-
rdoc_options:
|
|
192
|
-
|
|
223
|
+
rdoc_options:
|
|
224
|
+
- --charset=UTF-8
|
|
193
225
|
require_paths:
|
|
194
226
|
- lib
|
|
195
227
|
required_ruby_version: !ruby/object:Gem::Requirement
|
|
@@ -213,7 +245,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
213
245
|
requirements: []
|
|
214
246
|
|
|
215
247
|
rubyforge_project:
|
|
216
|
-
rubygems_version: 1.
|
|
248
|
+
rubygems_version: 1.3.7
|
|
217
249
|
signing_key:
|
|
218
250
|
specification_version: 3
|
|
219
251
|
summary: Flexible authentication solution for Rails with Warden
|
|
@@ -226,9 +258,9 @@ test_files:
|
|
|
226
258
|
- test/failure_app_test.rb
|
|
227
259
|
- test/integration/authenticatable_test.rb
|
|
228
260
|
- test/integration/confirmable_test.rb
|
|
261
|
+
- test/integration/database_authenticatable_test.rb
|
|
229
262
|
- test/integration/http_authenticatable_test.rb
|
|
230
263
|
- test/integration/lockable_test.rb
|
|
231
|
-
- test/integration/rack_middleware_test.rb
|
|
232
264
|
- test/integration/recoverable_test.rb
|
|
233
265
|
- test/integration/registerable_test.rb
|
|
234
266
|
- test/integration/rememberable_test.rb
|
|
@@ -239,8 +271,8 @@ test_files:
|
|
|
239
271
|
- test/mailers/reset_password_instructions_test.rb
|
|
240
272
|
- test/mailers/unlock_instructions_test.rb
|
|
241
273
|
- test/mapping_test.rb
|
|
242
|
-
- test/models/authenticatable_test.rb
|
|
243
274
|
- test/models/confirmable_test.rb
|
|
275
|
+
- test/models/database_authenticatable_test.rb
|
|
244
276
|
- test/models/lockable_test.rb
|
|
245
277
|
- test/models/recoverable_test.rb
|
|
246
278
|
- test/models/rememberable_test.rb
|
|
@@ -250,30 +282,39 @@ test_files:
|
|
|
250
282
|
- test/models/validatable_test.rb
|
|
251
283
|
- test/models_test.rb
|
|
252
284
|
- test/orm/active_record.rb
|
|
253
|
-
- test/orm/
|
|
285
|
+
- test/orm/mongoid.rb
|
|
254
286
|
- test/rails_app/app/active_record/admin.rb
|
|
287
|
+
- test/rails_app/app/active_record/shim.rb
|
|
255
288
|
- test/rails_app/app/active_record/user.rb
|
|
256
289
|
- test/rails_app/app/controllers/admins_controller.rb
|
|
257
290
|
- test/rails_app/app/controllers/application_controller.rb
|
|
258
291
|
- test/rails_app/app/controllers/home_controller.rb
|
|
292
|
+
- test/rails_app/app/controllers/publisher/registrations_controller.rb
|
|
293
|
+
- test/rails_app/app/controllers/publisher/sessions_controller.rb
|
|
294
|
+
- test/rails_app/app/controllers/sessions_controller.rb
|
|
259
295
|
- test/rails_app/app/controllers/users_controller.rb
|
|
260
296
|
- test/rails_app/app/helpers/application_helper.rb
|
|
261
|
-
- test/rails_app/app/
|
|
262
|
-
- test/rails_app/app/
|
|
297
|
+
- test/rails_app/app/mongoid/admin.rb
|
|
298
|
+
- test/rails_app/app/mongoid/shim.rb
|
|
299
|
+
- test/rails_app/app/mongoid/user.rb
|
|
300
|
+
- test/rails_app/config/application.rb
|
|
263
301
|
- test/rails_app/config/boot.rb
|
|
264
302
|
- test/rails_app/config/environment.rb
|
|
265
303
|
- test/rails_app/config/environments/development.rb
|
|
266
304
|
- test/rails_app/config/environments/production.rb
|
|
267
305
|
- test/rails_app/config/environments/test.rb
|
|
306
|
+
- test/rails_app/config/initializers/backtrace_silencers.rb
|
|
268
307
|
- test/rails_app/config/initializers/devise.rb
|
|
269
308
|
- test/rails_app/config/initializers/inflections.rb
|
|
270
|
-
- test/rails_app/config/initializers/
|
|
271
|
-
- test/rails_app/config/initializers/session_store.rb
|
|
309
|
+
- test/rails_app/config/initializers/secret_token.rb
|
|
272
310
|
- test/rails_app/config/routes.rb
|
|
311
|
+
- test/rails_app/db/migrate/20100401102949_create_tables.rb
|
|
312
|
+
- test/rails_app/db/schema.rb
|
|
273
313
|
- test/routes_test.rb
|
|
274
|
-
- test/support/
|
|
275
|
-
- test/support/
|
|
314
|
+
- test/support/assertions.rb
|
|
315
|
+
- test/support/helpers.rb
|
|
316
|
+
- test/support/integration.rb
|
|
276
317
|
- test/support/test_silencer.rb
|
|
277
|
-
- test/support/
|
|
318
|
+
- test/support/webrat/integrations/rails.rb
|
|
278
319
|
- test/test_helper.rb
|
|
279
320
|
- test/test_helpers_test.rb
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
class SessionsController < ApplicationController
|
|
2
|
-
prepend_before_filter :require_no_authentication, :only => [ :new, :create ]
|
|
3
|
-
include Devise::Controllers::InternalHelpers
|
|
4
|
-
|
|
5
|
-
# GET /resource/sign_in
|
|
6
|
-
def new
|
|
7
|
-
unless flash[:notice].present?
|
|
8
|
-
Devise::FLASH_MESSAGES.each do |message|
|
|
9
|
-
set_now_flash_message :alert, message if params.try(:[], message) == "true"
|
|
10
|
-
end
|
|
11
|
-
end
|
|
12
|
-
|
|
13
|
-
build_resource
|
|
14
|
-
render_with_scope :new
|
|
15
|
-
end
|
|
16
|
-
|
|
17
|
-
# POST /resource/sign_in
|
|
18
|
-
def create
|
|
19
|
-
if resource = authenticate(resource_name)
|
|
20
|
-
set_flash_message :notice, :signed_in
|
|
21
|
-
sign_in_and_redirect(resource_name, resource, true)
|
|
22
|
-
elsif [:custom, :redirect].include?(warden.result)
|
|
23
|
-
throw :warden, :scope => resource_name
|
|
24
|
-
else
|
|
25
|
-
set_now_flash_message :alert, (warden.message || :invalid)
|
|
26
|
-
clean_up_passwords(build_resource)
|
|
27
|
-
render_with_scope :new
|
|
28
|
-
end
|
|
29
|
-
end
|
|
30
|
-
|
|
31
|
-
# GET /resource/sign_out
|
|
32
|
-
def destroy
|
|
33
|
-
set_flash_message :notice, :signed_out if signed_in?(resource_name)
|
|
34
|
-
sign_out_and_redirect(resource_name)
|
|
35
|
-
end
|
|
36
|
-
|
|
37
|
-
protected
|
|
38
|
-
|
|
39
|
-
def clean_up_passwords(object)
|
|
40
|
-
object.clean_up_passwords if object.respond_to?(:clean_up_passwords)
|
|
41
|
-
end
|
|
42
|
-
end
|
data/app/models/devise_mailer.rb
DELETED
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
class DeviseMailer < ::ActionMailer::Base
|
|
2
|
-
extend Devise::Controllers::InternalHelpers::ScopedViews
|
|
3
|
-
|
|
4
|
-
# Deliver confirmation instructions when the user is created or its email is
|
|
5
|
-
# updated, and also when confirmation is manually requested
|
|
6
|
-
def confirmation_instructions(record)
|
|
7
|
-
setup_mail(record, :confirmation_instructions)
|
|
8
|
-
end
|
|
9
|
-
|
|
10
|
-
# Deliver reset password instructions when manually requested
|
|
11
|
-
def reset_password_instructions(record)
|
|
12
|
-
setup_mail(record, :reset_password_instructions)
|
|
13
|
-
end
|
|
14
|
-
|
|
15
|
-
def unlock_instructions(record)
|
|
16
|
-
setup_mail(record, :unlock_instructions)
|
|
17
|
-
end
|
|
18
|
-
|
|
19
|
-
private
|
|
20
|
-
|
|
21
|
-
# Configure default email options
|
|
22
|
-
def setup_mail(record, key)
|
|
23
|
-
scope_name = Devise::Mapping.find_scope!(record)
|
|
24
|
-
mapping = Devise.mappings[scope_name]
|
|
25
|
-
|
|
26
|
-
subject translate(mapping, key)
|
|
27
|
-
from mailer_sender(mapping)
|
|
28
|
-
recipients record.email
|
|
29
|
-
sent_on Time.now
|
|
30
|
-
content_type Devise.mailer_content_type
|
|
31
|
-
body render_with_scope(key, mapping, mapping.name => record, :resource => record)
|
|
32
|
-
end
|
|
33
|
-
|
|
34
|
-
def render_with_scope(key, mapping, assigns)
|
|
35
|
-
if self.class.scoped_views
|
|
36
|
-
begin
|
|
37
|
-
render :file => "devise_mailer/#{mapping.as}/#{key}", :body => assigns
|
|
38
|
-
rescue ActionView::MissingTemplate
|
|
39
|
-
render :file => "devise_mailer/#{key}", :body => assigns
|
|
40
|
-
end
|
|
41
|
-
else
|
|
42
|
-
render :file => "devise_mailer/#{key}", :body => assigns
|
|
43
|
-
end
|
|
44
|
-
end
|
|
45
|
-
|
|
46
|
-
def mailer_sender(mapping)
|
|
47
|
-
if Devise.mailer_sender.is_a?(Proc)
|
|
48
|
-
block_args = mapping.name if Devise.mailer_sender.arity > 0
|
|
49
|
-
Devise.mailer_sender.call(block_args)
|
|
50
|
-
else
|
|
51
|
-
Devise.mailer_sender
|
|
52
|
-
end
|
|
53
|
-
end
|
|
54
|
-
|
|
55
|
-
# Setup subject namespaced by model. It means you're able to setup your
|
|
56
|
-
# messages using specific resource scope, or provide a default one.
|
|
57
|
-
# Example (i18n locale file):
|
|
58
|
-
#
|
|
59
|
-
# en:
|
|
60
|
-
# devise:
|
|
61
|
-
# mailer:
|
|
62
|
-
# confirmation_instructions: '...'
|
|
63
|
-
# user:
|
|
64
|
-
# confirmation_instructions: '...'
|
|
65
|
-
def translate(mapping, key)
|
|
66
|
-
I18n.t(:"#{mapping.name}.#{key}", :scope => [:devise, :mailer], :default => key)
|
|
67
|
-
end
|
|
68
|
-
end
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
<h2>Resend confirmation instructions</h2>
|
|
2
|
-
|
|
3
|
-
<% form_for resource_name, resource, :url => confirmation_path(resource_name) do |f| %>
|
|
4
|
-
<%= f.error_messages %>
|
|
5
|
-
|
|
6
|
-
<p><%= f.label :email %></p>
|
|
7
|
-
<p><%= f.text_field :email %></p>
|
|
8
|
-
|
|
9
|
-
<p><%= f.submit "Resend confirmation instructions" %></p>
|
|
10
|
-
<% end %>
|
|
11
|
-
|
|
12
|
-
<%= render :partial => "shared/devise_links" %>
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
<h2>Change your password</h2>
|
|
2
|
-
|
|
3
|
-
<% form_for resource_name, resource, :url => password_path(resource_name), :html => { :method => :put } do |f| %>
|
|
4
|
-
<%= f.error_messages %>
|
|
5
|
-
<%= f.hidden_field :reset_password_token %>
|
|
6
|
-
|
|
7
|
-
<p><%= f.label :password %></p>
|
|
8
|
-
<p><%= f.password_field :password %></p>
|
|
9
|
-
|
|
10
|
-
<p><%= f.label :password_confirmation %></p>
|
|
11
|
-
<p><%= f.password_field :password_confirmation %></p>
|
|
12
|
-
|
|
13
|
-
<p><%= f.submit "Change my password" %></p>
|
|
14
|
-
<% end %>
|
|
15
|
-
|
|
16
|
-
<%= render :partial => "shared/devise_links" %>
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
<h2>Forgot your password?</h2>
|
|
2
|
-
|
|
3
|
-
<% form_for resource_name, resource, :url => password_path(resource_name) do |f| %>
|
|
4
|
-
<%= f.error_messages %>
|
|
5
|
-
|
|
6
|
-
<p><%= f.label :email %></p>
|
|
7
|
-
<p><%= f.text_field :email %></p>
|
|
8
|
-
|
|
9
|
-
<p><%= f.submit "Send me reset password instructions" %></p>
|
|
10
|
-
<% end %>
|
|
11
|
-
|
|
12
|
-
<%= render :partial => "shared/devise_links" %>
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
<h2>Edit <%= resource_name.to_s.humanize %></h2>
|
|
2
|
-
|
|
3
|
-
<% form_for resource_name, resource, :url => registration_path(resource_name), :html => { :method => :put } do |f| -%>
|
|
4
|
-
<%= f.error_messages %>
|
|
5
|
-
|
|
6
|
-
<p><%= f.label :email %></p>
|
|
7
|
-
<p><%= f.text_field :email %></p>
|
|
8
|
-
|
|
9
|
-
<p><%= f.label :password %> <i>(leave blank if you don't want to change it)</i></p>
|
|
10
|
-
<p><%= f.password_field :password %></p>
|
|
11
|
-
|
|
12
|
-
<p><%= f.label :password_confirmation %></p>
|
|
13
|
-
<p><%= f.password_field :password_confirmation %></p>
|
|
14
|
-
|
|
15
|
-
<p><%= f.label :current_password %> <i>(we need your current password to confirm your changes)</i></p>
|
|
16
|
-
<p><%= f.password_field :current_password %></p>
|
|
17
|
-
|
|
18
|
-
<p><%= f.submit "Update" %></p>
|
|
19
|
-
<% end -%>
|
|
20
|
-
|
|
21
|
-
<h3>Cancel my account</h3>
|
|
22
|
-
|
|
23
|
-
<p>Unhappy? <%= link_to "Cancel my account", registration_path(resource_name), :confirm => "Are you sure?", :method => :delete %>.</p>
|
|
24
|
-
|
|
25
|
-
<%= render :partial => "shared/devise_links" %>
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
<h2>Sign up</h2>
|
|
2
|
-
|
|
3
|
-
<% form_for resource_name, resource, :url => registration_path(resource_name) do |f| -%>
|
|
4
|
-
<%= f.error_messages %>
|
|
5
|
-
<p><%= f.label :email %></p>
|
|
6
|
-
<p><%= f.text_field :email %></p>
|
|
7
|
-
|
|
8
|
-
<p><%= f.label :password %></p>
|
|
9
|
-
<p><%= f.password_field :password %></p>
|
|
10
|
-
|
|
11
|
-
<p><%= f.label :password_confirmation %></p>
|
|
12
|
-
<p><%= f.password_field :password_confirmation %></p>
|
|
13
|
-
|
|
14
|
-
<p><%= f.submit "Sign up" %></p>
|
|
15
|
-
<% end -%>
|
|
16
|
-
|
|
17
|
-
<%= render :partial => "shared/devise_links" %>
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
<h2>Sign in</h2>
|
|
2
|
-
|
|
3
|
-
<% form_for resource_name, resource, :url => session_path(resource_name) do |f| -%>
|
|
4
|
-
<p><%= f.label :email %></p>
|
|
5
|
-
<p><%= f.text_field :email %></p>
|
|
6
|
-
|
|
7
|
-
<p><%= f.label :password %></p>
|
|
8
|
-
<p><%= f.password_field :password %></p>
|
|
9
|
-
|
|
10
|
-
<% if devise_mapping.rememberable? -%>
|
|
11
|
-
<p><%= f.check_box :remember_me %> <%= f.label :remember_me %></p>
|
|
12
|
-
<% end -%>
|
|
13
|
-
|
|
14
|
-
<p><%= f.submit "Sign in" %></p>
|
|
15
|
-
<% end -%>
|
|
16
|
-
|
|
17
|
-
<%= render :partial => "shared/devise_links" %>
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
<%- if controller_name != 'sessions' %>
|
|
2
|
-
<%= link_to t('devise.sessions.link'), new_session_path(resource_name) %><br />
|
|
3
|
-
<% end -%>
|
|
4
|
-
|
|
5
|
-
<%- if devise_mapping.registerable? && controller_name != 'registrations' %>
|
|
6
|
-
<%= link_to t('devise.registrations.link'), new_registration_path(resource_name) %><br />
|
|
7
|
-
<% end -%>
|
|
8
|
-
|
|
9
|
-
<%- if devise_mapping.recoverable? && controller_name != 'passwords' %>
|
|
10
|
-
<%= link_to t('devise.passwords.link'), new_password_path(resource_name) %><br />
|
|
11
|
-
<% end -%>
|
|
12
|
-
|
|
13
|
-
<%- if devise_mapping.confirmable? && controller_name != 'confirmations' %>
|
|
14
|
-
<%= link_to t('devise.confirmations.link'), new_confirmation_path(resource_name) %><br />
|
|
15
|
-
<% end -%>
|
|
16
|
-
|
|
17
|
-
<%- if devise_mapping.lockable? && controller_name != 'unlocks' %>
|
|
18
|
-
<%= link_to t('devise.unlocks.link'), new_unlock_path(resource_name) %><br />
|
|
19
|
-
<% end -%>
|