devise 3.0.0 → 4.8.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/CHANGELOG.md +351 -0
- data/MIT-LICENSE +2 -1
- data/README.md +422 -130
- data/app/controllers/devise/confirmations_controller.rb +17 -6
- data/app/controllers/devise/omniauth_callbacks_controller.rb +12 -6
- data/app/controllers/devise/passwords_controller.rb +23 -8
- data/app/controllers/devise/registrations_controller.rb +70 -28
- data/app/controllers/devise/sessions_controller.rb +49 -17
- data/app/controllers/devise/unlocks_controller.rb +11 -4
- data/app/controllers/devise_controller.rb +74 -34
- data/app/helpers/devise_helper.rb +23 -18
- data/app/mailers/devise/mailer.rb +25 -10
- data/app/views/devise/confirmations/new.html.erb +9 -5
- data/app/views/devise/mailer/confirmation_instructions.html.erb +1 -1
- data/app/views/devise/mailer/email_changed.html.erb +7 -0
- data/app/views/devise/mailer/password_change.html.erb +3 -0
- data/app/views/devise/mailer/reset_password_instructions.html.erb +1 -1
- data/app/views/devise/mailer/unlock_instructions.html.erb +1 -1
- data/app/views/devise/passwords/edit.html.erb +16 -7
- data/app/views/devise/passwords/new.html.erb +9 -5
- data/app/views/devise/registrations/edit.html.erb +29 -15
- data/app/views/devise/registrations/new.html.erb +20 -9
- data/app/views/devise/sessions/new.html.erb +19 -10
- data/app/views/devise/shared/_error_messages.html.erb +15 -0
- data/app/views/devise/shared/{_links.erb → _links.html.erb} +10 -10
- data/app/views/devise/unlocks/new.html.erb +9 -5
- data/config/locales/en.yml +26 -20
- data/lib/devise/controllers/helpers.rb +122 -125
- data/lib/devise/controllers/rememberable.rb +14 -14
- data/lib/devise/controllers/scoped_views.rb +3 -1
- data/lib/devise/controllers/sign_in_out.rb +121 -0
- data/lib/devise/controllers/store_location.rb +76 -0
- data/lib/devise/controllers/url_helpers.rb +10 -8
- data/lib/devise/delegator.rb +2 -0
- data/lib/devise/encryptor.rb +24 -0
- data/lib/devise/failure_app.rb +132 -42
- data/lib/devise/hooks/activatable.rb +7 -6
- data/lib/devise/hooks/csrf_cleaner.rb +9 -0
- data/lib/devise/hooks/forgetable.rb +3 -1
- data/lib/devise/hooks/lockable.rb +5 -3
- data/lib/devise/hooks/proxy.rb +23 -0
- data/lib/devise/hooks/rememberable.rb +7 -4
- data/lib/devise/hooks/timeoutable.rb +18 -8
- data/lib/devise/hooks/trackable.rb +3 -1
- data/lib/devise/mailers/helpers.rb +15 -18
- data/lib/devise/mapping.rb +9 -3
- data/lib/devise/models/authenticatable.rb +102 -80
- data/lib/devise/models/confirmable.rb +154 -72
- data/lib/devise/models/database_authenticatable.rb +125 -25
- data/lib/devise/models/lockable.rb +50 -29
- data/lib/devise/models/omniauthable.rb +3 -1
- data/lib/devise/models/recoverable.rb +72 -50
- data/lib/devise/models/registerable.rb +4 -0
- data/lib/devise/models/rememberable.rb +65 -32
- data/lib/devise/models/timeoutable.rb +4 -8
- data/lib/devise/models/trackable.rb +20 -4
- data/lib/devise/models/validatable.rb +16 -9
- data/lib/devise/models.rb +6 -13
- data/lib/devise/modules.rb +12 -11
- data/lib/devise/omniauth/config.rb +2 -0
- data/lib/devise/omniauth/url_helpers.rb +14 -5
- data/lib/devise/omniauth.rb +4 -5
- data/lib/devise/orm/active_record.rb +5 -1
- data/lib/devise/orm/mongoid.rb +6 -2
- data/lib/devise/parameter_filter.rb +4 -0
- data/lib/devise/parameter_sanitizer.rb +144 -34
- data/lib/devise/rails/deprecated_constant_accessor.rb +39 -0
- data/lib/devise/rails/routes.rb +191 -127
- data/lib/devise/rails/warden_compat.rb +2 -1
- data/lib/devise/rails.rb +13 -20
- data/lib/devise/secret_key_finder.rb +27 -0
- data/lib/devise/strategies/authenticatable.rb +21 -22
- data/lib/devise/strategies/base.rb +3 -1
- data/lib/devise/strategies/database_authenticatable.rb +15 -4
- data/lib/devise/strategies/rememberable.rb +15 -3
- data/lib/devise/test/controller_helpers.rb +167 -0
- data/lib/devise/test/integration_helpers.rb +63 -0
- data/lib/devise/test_helpers.rb +7 -123
- data/lib/devise/time_inflector.rb +4 -2
- data/lib/devise/token_generator.rb +32 -0
- data/lib/devise/version.rb +3 -1
- data/lib/devise.rb +124 -78
- data/lib/generators/active_record/devise_generator.rb +64 -15
- data/lib/generators/active_record/templates/migration.rb +9 -8
- data/lib/generators/active_record/templates/migration_existing.rb +9 -8
- data/lib/generators/devise/controllers_generator.rb +46 -0
- data/lib/generators/devise/devise_generator.rb +10 -6
- data/lib/generators/devise/install_generator.rb +19 -1
- data/lib/generators/devise/orm_helpers.rb +17 -9
- data/lib/generators/devise/views_generator.rb +51 -28
- data/lib/generators/mongoid/devise_generator.rb +24 -24
- data/lib/generators/templates/README +13 -12
- data/lib/generators/templates/controllers/README +14 -0
- data/lib/generators/templates/controllers/confirmations_controller.rb +30 -0
- data/lib/generators/templates/controllers/omniauth_callbacks_controller.rb +30 -0
- data/lib/generators/templates/controllers/passwords_controller.rb +34 -0
- data/lib/generators/templates/controllers/registrations_controller.rb +62 -0
- data/lib/generators/templates/controllers/sessions_controller.rb +27 -0
- data/lib/generators/templates/controllers/unlocks_controller.rb +30 -0
- data/lib/generators/templates/devise.rb +118 -53
- data/lib/generators/templates/markerb/confirmation_instructions.markerb +1 -1
- data/lib/generators/templates/markerb/email_changed.markerb +7 -0
- data/lib/generators/templates/markerb/password_change.markerb +3 -0
- data/lib/generators/templates/markerb/reset_password_instructions.markerb +1 -1
- data/lib/generators/templates/markerb/unlock_instructions.markerb +1 -1
- data/lib/generators/templates/simple_form_for/confirmations/new.html.erb +6 -2
- data/lib/generators/templates/simple_form_for/passwords/edit.html.erb +12 -4
- data/lib/generators/templates/simple_form_for/passwords/new.html.erb +5 -2
- data/lib/generators/templates/simple_form_for/registrations/edit.html.erb +14 -6
- data/lib/generators/templates/simple_form_for/registrations/new.html.erb +12 -4
- data/lib/generators/templates/simple_form_for/sessions/new.html.erb +11 -6
- data/lib/generators/templates/simple_form_for/unlocks/new.html.erb +5 -2
- metadata +73 -294
- data/.gitignore +0 -10
- data/.travis.yml +0 -20
- data/.yardopts +0 -9
- data/CHANGELOG.rdoc +0 -941
- data/CONTRIBUTING.md +0 -14
- data/Gemfile +0 -31
- data/Gemfile.lock +0 -159
- data/Rakefile +0 -35
- data/app/views/devise/_links.erb +0 -3
- data/devise.gemspec +0 -26
- data/devise.png +0 -0
- data/gemfiles/Gemfile.rails-3.2.x +0 -31
- data/gemfiles/Gemfile.rails-3.2.x.lock +0 -156
- data/lib/devise/models/token_authenticatable.rb +0 -89
- data/lib/devise/strategies/token_authenticatable.rb +0 -91
- data/test/controllers/custom_strategy_test.rb +0 -62
- data/test/controllers/helpers_test.rb +0 -253
- data/test/controllers/internal_helpers_test.rb +0 -120
- data/test/controllers/passwords_controller_test.rb +0 -32
- data/test/controllers/sessions_controller_test.rb +0 -99
- data/test/controllers/url_helpers_test.rb +0 -59
- data/test/delegator_test.rb +0 -19
- data/test/devise_test.rb +0 -83
- data/test/failure_app_test.rb +0 -221
- data/test/generators/active_record_generator_test.rb +0 -73
- data/test/generators/devise_generator_test.rb +0 -39
- data/test/generators/install_generator_test.rb +0 -13
- data/test/generators/mongoid_generator_test.rb +0 -23
- data/test/generators/views_generator_test.rb +0 -67
- data/test/helpers/devise_helper_test.rb +0 -51
- data/test/integration/authenticatable_test.rb +0 -699
- data/test/integration/confirmable_test.rb +0 -299
- data/test/integration/database_authenticatable_test.rb +0 -84
- data/test/integration/http_authenticatable_test.rb +0 -115
- data/test/integration/lockable_test.rb +0 -242
- data/test/integration/omniauthable_test.rb +0 -133
- data/test/integration/recoverable_test.rb +0 -335
- data/test/integration/registerable_test.rb +0 -349
- data/test/integration/rememberable_test.rb +0 -165
- data/test/integration/timeoutable_test.rb +0 -150
- data/test/integration/token_authenticatable_test.rb +0 -205
- data/test/integration/trackable_test.rb +0 -92
- data/test/mailers/confirmation_instructions_test.rb +0 -111
- data/test/mailers/reset_password_instructions_test.rb +0 -92
- data/test/mailers/unlock_instructions_test.rb +0 -87
- data/test/mapping_test.rb +0 -127
- data/test/models/authenticatable_test.rb +0 -13
- data/test/models/confirmable_test.rb +0 -452
- data/test/models/database_authenticatable_test.rb +0 -226
- data/test/models/lockable_test.rb +0 -282
- data/test/models/omniauthable_test.rb +0 -7
- data/test/models/recoverable_test.rb +0 -222
- data/test/models/registerable_test.rb +0 -7
- data/test/models/rememberable_test.rb +0 -175
- data/test/models/serializable_test.rb +0 -49
- data/test/models/timeoutable_test.rb +0 -46
- data/test/models/token_authenticatable_test.rb +0 -55
- data/test/models/trackable_test.rb +0 -13
- data/test/models/validatable_test.rb +0 -127
- data/test/models_test.rb +0 -163
- data/test/omniauth/config_test.rb +0 -57
- data/test/omniauth/url_helpers_test.rb +0 -54
- data/test/orm/active_record.rb +0 -10
- data/test/orm/mongoid.rb +0 -13
- data/test/parameter_sanitizer_test.rb +0 -58
- data/test/rails_app/Rakefile +0 -6
- data/test/rails_app/app/active_record/admin.rb +0 -6
- data/test/rails_app/app/active_record/shim.rb +0 -2
- data/test/rails_app/app/active_record/user.rb +0 -6
- data/test/rails_app/app/controllers/admins/sessions_controller.rb +0 -6
- data/test/rails_app/app/controllers/admins_controller.rb +0 -11
- data/test/rails_app/app/controllers/application_controller.rb +0 -9
- data/test/rails_app/app/controllers/home_controller.rb +0 -25
- data/test/rails_app/app/controllers/publisher/registrations_controller.rb +0 -2
- data/test/rails_app/app/controllers/publisher/sessions_controller.rb +0 -2
- data/test/rails_app/app/controllers/users/omniauth_callbacks_controller.rb +0 -14
- data/test/rails_app/app/controllers/users_controller.rb +0 -31
- data/test/rails_app/app/helpers/application_helper.rb +0 -3
- data/test/rails_app/app/mailers/users/mailer.rb +0 -12
- data/test/rails_app/app/mongoid/admin.rb +0 -29
- data/test/rails_app/app/mongoid/shim.rb +0 -23
- data/test/rails_app/app/mongoid/user.rb +0 -42
- data/test/rails_app/app/views/admins/index.html.erb +0 -1
- data/test/rails_app/app/views/admins/sessions/new.html.erb +0 -2
- data/test/rails_app/app/views/home/admin_dashboard.html.erb +0 -1
- data/test/rails_app/app/views/home/index.html.erb +0 -1
- data/test/rails_app/app/views/home/join.html.erb +0 -1
- data/test/rails_app/app/views/home/private.html.erb +0 -1
- data/test/rails_app/app/views/home/user_dashboard.html.erb +0 -1
- data/test/rails_app/app/views/layouts/application.html.erb +0 -24
- data/test/rails_app/app/views/users/edit_form.html.erb +0 -1
- data/test/rails_app/app/views/users/index.html.erb +0 -1
- data/test/rails_app/app/views/users/mailer/confirmation_instructions.erb +0 -1
- data/test/rails_app/app/views/users/sessions/new.html.erb +0 -1
- data/test/rails_app/bin/bundle +0 -3
- data/test/rails_app/bin/rails +0 -4
- data/test/rails_app/bin/rake +0 -4
- data/test/rails_app/config/application.rb +0 -40
- data/test/rails_app/config/boot.rb +0 -8
- data/test/rails_app/config/database.yml +0 -18
- data/test/rails_app/config/environment.rb +0 -5
- data/test/rails_app/config/environments/development.rb +0 -34
- data/test/rails_app/config/environments/production.rb +0 -84
- data/test/rails_app/config/environments/test.rb +0 -36
- data/test/rails_app/config/initializers/backtrace_silencers.rb +0 -7
- data/test/rails_app/config/initializers/devise.rb +0 -178
- data/test/rails_app/config/initializers/inflections.rb +0 -2
- data/test/rails_app/config/initializers/secret_token.rb +0 -8
- data/test/rails_app/config/initializers/session_store.rb +0 -1
- data/test/rails_app/config/routes.rb +0 -104
- data/test/rails_app/config.ru +0 -4
- data/test/rails_app/db/migrate/20100401102949_create_tables.rb +0 -74
- data/test/rails_app/db/schema.rb +0 -52
- data/test/rails_app/lib/shared_admin.rb +0 -14
- data/test/rails_app/lib/shared_user.rb +0 -25
- data/test/rails_app/public/404.html +0 -26
- data/test/rails_app/public/422.html +0 -26
- data/test/rails_app/public/500.html +0 -26
- data/test/rails_app/public/favicon.ico +0 -0
- data/test/routes_test.rb +0 -250
- data/test/support/assertions.rb +0 -40
- data/test/support/helpers.rb +0 -91
- data/test/support/integration.rb +0 -92
- data/test/support/locale/en.yml +0 -4
- data/test/support/webrat/integrations/rails.rb +0 -24
- data/test/test_helper.rb +0 -34
- data/test/test_helpers_test.rb +0 -151
- data/test/test_models.rb +0 -26
data/CONTRIBUTING.md
DELETED
@@ -1,14 +0,0 @@
|
|
1
|
-
### Please read before contributing
|
2
|
-
|
3
|
-
1) Do not post questions in the issues tracker. If you have any questions about Devise, search the [Wiki](https://github.com/plataformatec/devise/wiki) or use the [Mailing List](https://groups.google.com/group/plataformatec-devise) or [Stack Overflow](http://stackoverflow.com/questions/tagged/devise).
|
4
|
-
|
5
|
-
2) If you find a security bug, **DO NOT** submit an issue here. Please send an e-mail to [developers@plataformatec.com.br](mailto:developers@plataformatec.com.br) instead.
|
6
|
-
|
7
|
-
3) Do a small search on the issues tracker before submitting your issue to see if it was already reported / fixed.
|
8
|
-
|
9
|
-
4) When reporting an issue, include Rails, Devise and Warden versions. If you are getting exceptions, please include the full backtrace.
|
10
|
-
|
11
|
-
That's it! The more information you give, the easier it becomes for us to track it down and fix it.
|
12
|
-
Ideally, you should provide an application that reproduces the error or a test case to Devise's suite.
|
13
|
-
|
14
|
-
Thanks!
|
data/Gemfile
DELETED
@@ -1,31 +0,0 @@
|
|
1
|
-
source "https://rubygems.org"
|
2
|
-
|
3
|
-
gemspec
|
4
|
-
|
5
|
-
gem "rails", "~> 4.0.0"
|
6
|
-
gem "omniauth", "~> 1.0.0"
|
7
|
-
gem "omniauth-oauth2", "~> 1.0.0"
|
8
|
-
gem "rdoc"
|
9
|
-
|
10
|
-
group :test do
|
11
|
-
gem "omniauth-facebook"
|
12
|
-
gem "omniauth-openid", "~> 1.0.1"
|
13
|
-
gem "webrat", "0.7.3", :require => false
|
14
|
-
gem "mocha", "~> 0.13.1", :require => false
|
15
|
-
end
|
16
|
-
|
17
|
-
platforms :jruby do
|
18
|
-
gem "activerecord-jdbc-adapter"
|
19
|
-
gem "activerecord-jdbcsqlite3-adapter"
|
20
|
-
gem "jruby-openssl"
|
21
|
-
end
|
22
|
-
|
23
|
-
platforms :ruby do
|
24
|
-
gem "sqlite3"
|
25
|
-
end
|
26
|
-
|
27
|
-
platforms :mri_19, :mri_20 do
|
28
|
-
group :mongoid do
|
29
|
-
gem "mongoid", github: "mongoid/mongoid", branch: "master"
|
30
|
-
end
|
31
|
-
end
|
data/Gemfile.lock
DELETED
@@ -1,159 +0,0 @@
|
|
1
|
-
GIT
|
2
|
-
remote: git://github.com/mongoid/mongoid.git
|
3
|
-
revision: fe7f43430580860db6d1d89cea27eda24ab60ab1
|
4
|
-
branch: master
|
5
|
-
specs:
|
6
|
-
mongoid (4.0.0)
|
7
|
-
activemodel (~> 4.0.0.rc1)
|
8
|
-
moped (~> 1.4.2)
|
9
|
-
origin (~> 1.0)
|
10
|
-
tzinfo (~> 0.3.22)
|
11
|
-
|
12
|
-
PATH
|
13
|
-
remote: .
|
14
|
-
specs:
|
15
|
-
devise (3.0.0.rc)
|
16
|
-
bcrypt-ruby (~> 3.0)
|
17
|
-
orm_adapter (~> 0.1)
|
18
|
-
railties (>= 3.2.6, < 5)
|
19
|
-
warden (~> 1.2.3)
|
20
|
-
|
21
|
-
GEM
|
22
|
-
remote: https://rubygems.org/
|
23
|
-
specs:
|
24
|
-
actionmailer (4.0.0)
|
25
|
-
actionpack (= 4.0.0)
|
26
|
-
mail (~> 2.5.3)
|
27
|
-
actionpack (4.0.0)
|
28
|
-
activesupport (= 4.0.0)
|
29
|
-
builder (~> 3.1.0)
|
30
|
-
erubis (~> 2.7.0)
|
31
|
-
rack (~> 1.5.2)
|
32
|
-
rack-test (~> 0.6.2)
|
33
|
-
activemodel (4.0.0)
|
34
|
-
activesupport (= 4.0.0)
|
35
|
-
builder (~> 3.1.0)
|
36
|
-
activerecord (4.0.0)
|
37
|
-
activemodel (= 4.0.0)
|
38
|
-
activerecord-deprecated_finders (~> 1.0.2)
|
39
|
-
activesupport (= 4.0.0)
|
40
|
-
arel (~> 4.0.0)
|
41
|
-
activerecord-deprecated_finders (1.0.3)
|
42
|
-
activesupport (4.0.0)
|
43
|
-
i18n (~> 0.6, >= 0.6.4)
|
44
|
-
minitest (~> 4.2)
|
45
|
-
multi_json (~> 1.3)
|
46
|
-
thread_safe (~> 0.1)
|
47
|
-
tzinfo (~> 0.3.37)
|
48
|
-
arel (4.0.0)
|
49
|
-
atomic (1.1.10)
|
50
|
-
bcrypt-ruby (3.1.1)
|
51
|
-
builder (3.1.4)
|
52
|
-
erubis (2.7.0)
|
53
|
-
faraday (0.8.7)
|
54
|
-
multipart-post (~> 1.1)
|
55
|
-
hashie (1.2.0)
|
56
|
-
hike (1.2.3)
|
57
|
-
httpauth (0.2.0)
|
58
|
-
i18n (0.6.4)
|
59
|
-
json (1.7.7)
|
60
|
-
jwt (0.1.8)
|
61
|
-
multi_json (>= 1.5)
|
62
|
-
mail (2.5.4)
|
63
|
-
mime-types (~> 1.16)
|
64
|
-
treetop (~> 1.4.8)
|
65
|
-
metaclass (0.0.1)
|
66
|
-
mime-types (1.23)
|
67
|
-
minitest (4.7.5)
|
68
|
-
mocha (0.13.3)
|
69
|
-
metaclass (~> 0.0.1)
|
70
|
-
moped (1.4.5)
|
71
|
-
multi_json (1.7.7)
|
72
|
-
multipart-post (1.2.0)
|
73
|
-
nokogiri (1.5.9)
|
74
|
-
oauth2 (0.8.1)
|
75
|
-
faraday (~> 0.8)
|
76
|
-
httpauth (~> 0.1)
|
77
|
-
jwt (~> 0.1.4)
|
78
|
-
multi_json (~> 1.0)
|
79
|
-
rack (~> 1.2)
|
80
|
-
omniauth (1.0.3)
|
81
|
-
hashie (~> 1.2)
|
82
|
-
rack
|
83
|
-
omniauth-facebook (1.4.0)
|
84
|
-
omniauth-oauth2 (~> 1.0.2)
|
85
|
-
omniauth-oauth2 (1.0.3)
|
86
|
-
oauth2 (~> 0.8.0)
|
87
|
-
omniauth (~> 1.0)
|
88
|
-
omniauth-openid (1.0.1)
|
89
|
-
omniauth (~> 1.0)
|
90
|
-
rack-openid (~> 1.3.1)
|
91
|
-
origin (1.1.0)
|
92
|
-
orm_adapter (0.4.0)
|
93
|
-
polyglot (0.3.3)
|
94
|
-
rack (1.5.2)
|
95
|
-
rack-openid (1.3.1)
|
96
|
-
rack (>= 1.1.0)
|
97
|
-
ruby-openid (>= 2.1.8)
|
98
|
-
rack-test (0.6.2)
|
99
|
-
rack (>= 1.0)
|
100
|
-
rails (4.0.0)
|
101
|
-
actionmailer (= 4.0.0)
|
102
|
-
actionpack (= 4.0.0)
|
103
|
-
activerecord (= 4.0.0)
|
104
|
-
activesupport (= 4.0.0)
|
105
|
-
bundler (>= 1.3.0, < 2.0)
|
106
|
-
railties (= 4.0.0)
|
107
|
-
sprockets-rails (~> 2.0.0)
|
108
|
-
railties (4.0.0)
|
109
|
-
actionpack (= 4.0.0)
|
110
|
-
activesupport (= 4.0.0)
|
111
|
-
rake (>= 0.8.7)
|
112
|
-
thor (>= 0.18.1, < 2.0)
|
113
|
-
rake (10.1.0)
|
114
|
-
rdoc (4.0.1)
|
115
|
-
json (~> 1.4)
|
116
|
-
ruby-openid (2.2.3)
|
117
|
-
sprockets (2.10.0)
|
118
|
-
hike (~> 1.2)
|
119
|
-
multi_json (~> 1.0)
|
120
|
-
rack (~> 1.0)
|
121
|
-
tilt (~> 1.1, != 1.3.0)
|
122
|
-
sprockets-rails (2.0.0)
|
123
|
-
actionpack (>= 3.0)
|
124
|
-
activesupport (>= 3.0)
|
125
|
-
sprockets (~> 2.8)
|
126
|
-
sqlite3 (1.3.7)
|
127
|
-
thor (0.18.1)
|
128
|
-
thread_safe (0.1.0)
|
129
|
-
atomic
|
130
|
-
tilt (1.4.1)
|
131
|
-
treetop (1.4.14)
|
132
|
-
polyglot
|
133
|
-
polyglot (>= 0.3.1)
|
134
|
-
tzinfo (0.3.37)
|
135
|
-
warden (1.2.3)
|
136
|
-
rack (>= 1.0)
|
137
|
-
webrat (0.7.3)
|
138
|
-
nokogiri (>= 1.2.0)
|
139
|
-
rack (>= 1.0)
|
140
|
-
rack-test (>= 0.5.3)
|
141
|
-
|
142
|
-
PLATFORMS
|
143
|
-
ruby
|
144
|
-
|
145
|
-
DEPENDENCIES
|
146
|
-
activerecord-jdbc-adapter
|
147
|
-
activerecord-jdbcsqlite3-adapter
|
148
|
-
devise!
|
149
|
-
jruby-openssl
|
150
|
-
mocha (~> 0.13.1)
|
151
|
-
mongoid!
|
152
|
-
omniauth (~> 1.0.0)
|
153
|
-
omniauth-facebook
|
154
|
-
omniauth-oauth2 (~> 1.0.0)
|
155
|
-
omniauth-openid (~> 1.0.1)
|
156
|
-
rails (~> 4.0.0)
|
157
|
-
rdoc
|
158
|
-
sqlite3
|
159
|
-
webrat (= 0.7.3)
|
data/Rakefile
DELETED
@@ -1,35 +0,0 @@
|
|
1
|
-
# encoding: UTF-8
|
2
|
-
require "bundler/gem_tasks"
|
3
|
-
require 'rake/testtask'
|
4
|
-
require 'rdoc/task'
|
5
|
-
|
6
|
-
desc 'Default: run tests for all ORMs.'
|
7
|
-
task :default => :test
|
8
|
-
|
9
|
-
desc 'Run Devise tests for all ORMs.'
|
10
|
-
task :pre_commit do
|
11
|
-
Dir[File.join(File.dirname(__FILE__), 'test', 'orm', '*.rb')].each do |file|
|
12
|
-
orm = File.basename(file).split(".").first
|
13
|
-
# "Some day, my son, rake's inner wisdom will reveal itself. Until then,
|
14
|
-
# take this `system` -- may its brute force protect you well."
|
15
|
-
exit 1 unless system "rake test DEVISE_ORM=#{orm}"
|
16
|
-
end
|
17
|
-
end
|
18
|
-
|
19
|
-
desc 'Run Devise unit tests.'
|
20
|
-
Rake::TestTask.new(:test) do |t|
|
21
|
-
t.libs << 'lib'
|
22
|
-
t.libs << 'test'
|
23
|
-
t.pattern = 'test/**/*_test.rb'
|
24
|
-
t.verbose = true
|
25
|
-
t.warning = false
|
26
|
-
end
|
27
|
-
|
28
|
-
desc 'Generate documentation for Devise.'
|
29
|
-
Rake::RDocTask.new(:rdoc) do |rdoc|
|
30
|
-
rdoc.rdoc_dir = 'rdoc'
|
31
|
-
rdoc.title = 'Devise'
|
32
|
-
rdoc.options << '--line-numbers' << '--inline-source'
|
33
|
-
rdoc.rdoc_files.include('README.md')
|
34
|
-
rdoc.rdoc_files.include('lib/**/*.rb')
|
35
|
-
end
|
data/app/views/devise/_links.erb
DELETED
data/devise.gemspec
DELETED
@@ -1,26 +0,0 @@
|
|
1
|
-
# -*- encoding: utf-8 -*-
|
2
|
-
$:.push File.expand_path("../lib", __FILE__)
|
3
|
-
require "devise/version"
|
4
|
-
|
5
|
-
Gem::Specification.new do |s|
|
6
|
-
s.name = "devise"
|
7
|
-
s.version = Devise::VERSION.dup
|
8
|
-
s.platform = Gem::Platform::RUBY
|
9
|
-
s.licenses = ["MIT"]
|
10
|
-
s.summary = "Flexible authentication solution for Rails with Warden"
|
11
|
-
s.email = "contact@plataformatec.com.br"
|
12
|
-
s.homepage = "http://github.com/plataformatec/devise"
|
13
|
-
s.description = "Flexible authentication solution for Rails with Warden"
|
14
|
-
s.authors = ['José Valim', 'Carlos Antônio']
|
15
|
-
|
16
|
-
s.rubyforge_project = "devise"
|
17
|
-
|
18
|
-
s.files = `git ls-files`.split("\n")
|
19
|
-
s.test_files = `git ls-files -- test/*`.split("\n")
|
20
|
-
s.require_paths = ["lib"]
|
21
|
-
|
22
|
-
s.add_dependency("warden", "~> 1.2.3")
|
23
|
-
s.add_dependency("orm_adapter", "~> 0.1")
|
24
|
-
s.add_dependency("bcrypt-ruby", "~> 3.0")
|
25
|
-
s.add_dependency("railties", ">= 3.2.6", "< 5")
|
26
|
-
end
|
data/devise.png
DELETED
Binary file
|
@@ -1,31 +0,0 @@
|
|
1
|
-
source "https://rubygems.org"
|
2
|
-
|
3
|
-
gemspec :path => '..'
|
4
|
-
|
5
|
-
gem "rails", "~> 3.2.6"
|
6
|
-
gem "omniauth", "~> 1.0.0"
|
7
|
-
gem "omniauth-oauth2", "~> 1.0.0"
|
8
|
-
gem "rdoc"
|
9
|
-
|
10
|
-
group :test do
|
11
|
-
gem "omniauth-facebook"
|
12
|
-
gem "omniauth-openid", "~> 1.0.1"
|
13
|
-
gem "webrat", "0.7.3", :require => false
|
14
|
-
gem "mocha", "~> 0.13.1", :require => false
|
15
|
-
end
|
16
|
-
|
17
|
-
platforms :jruby do
|
18
|
-
gem "activerecord-jdbc-adapter"
|
19
|
-
gem "activerecord-jdbcsqlite3-adapter"
|
20
|
-
gem "jruby-openssl"
|
21
|
-
end
|
22
|
-
|
23
|
-
platforms :ruby do
|
24
|
-
gem "sqlite3"
|
25
|
-
end
|
26
|
-
|
27
|
-
platforms :mri_19, :mri_20 do
|
28
|
-
group :mongoid do
|
29
|
-
gem "mongoid", "~> 3.0"
|
30
|
-
end
|
31
|
-
end
|
@@ -1,156 +0,0 @@
|
|
1
|
-
PATH
|
2
|
-
remote: ..
|
3
|
-
specs:
|
4
|
-
devise (3.0.0.rc)
|
5
|
-
bcrypt-ruby (~> 3.0)
|
6
|
-
orm_adapter (~> 0.1)
|
7
|
-
railties (>= 3.2.6, < 5)
|
8
|
-
warden (~> 1.2.1)
|
9
|
-
|
10
|
-
GEM
|
11
|
-
remote: https://rubygems.org/
|
12
|
-
specs:
|
13
|
-
actionmailer (3.2.13)
|
14
|
-
actionpack (= 3.2.13)
|
15
|
-
mail (~> 2.5.3)
|
16
|
-
actionpack (3.2.13)
|
17
|
-
activemodel (= 3.2.13)
|
18
|
-
activesupport (= 3.2.13)
|
19
|
-
builder (~> 3.0.0)
|
20
|
-
erubis (~> 2.7.0)
|
21
|
-
journey (~> 1.0.4)
|
22
|
-
rack (~> 1.4.5)
|
23
|
-
rack-cache (~> 1.2)
|
24
|
-
rack-test (~> 0.6.1)
|
25
|
-
sprockets (~> 2.2.1)
|
26
|
-
activemodel (3.2.13)
|
27
|
-
activesupport (= 3.2.13)
|
28
|
-
builder (~> 3.0.0)
|
29
|
-
activerecord (3.2.13)
|
30
|
-
activemodel (= 3.2.13)
|
31
|
-
activesupport (= 3.2.13)
|
32
|
-
arel (~> 3.0.2)
|
33
|
-
tzinfo (~> 0.3.29)
|
34
|
-
activeresource (3.2.13)
|
35
|
-
activemodel (= 3.2.13)
|
36
|
-
activesupport (= 3.2.13)
|
37
|
-
activesupport (3.2.13)
|
38
|
-
i18n (= 0.6.1)
|
39
|
-
multi_json (~> 1.0)
|
40
|
-
arel (3.0.2)
|
41
|
-
bcrypt-ruby (3.0.1)
|
42
|
-
builder (3.0.4)
|
43
|
-
erubis (2.7.0)
|
44
|
-
faraday (0.8.7)
|
45
|
-
multipart-post (~> 1.1)
|
46
|
-
hashie (1.2.0)
|
47
|
-
hike (1.2.2)
|
48
|
-
httpauth (0.2.0)
|
49
|
-
i18n (0.6.1)
|
50
|
-
journey (1.0.4)
|
51
|
-
json (1.7.7)
|
52
|
-
jwt (0.1.8)
|
53
|
-
multi_json (>= 1.5)
|
54
|
-
mail (2.5.3)
|
55
|
-
i18n (>= 0.4.0)
|
56
|
-
mime-types (~> 1.16)
|
57
|
-
treetop (~> 1.4.8)
|
58
|
-
metaclass (0.0.1)
|
59
|
-
mime-types (1.23)
|
60
|
-
mocha (0.13.3)
|
61
|
-
metaclass (~> 0.0.1)
|
62
|
-
mongoid (3.1.3)
|
63
|
-
activemodel (~> 3.2)
|
64
|
-
moped (~> 1.4.2)
|
65
|
-
origin (~> 1.0)
|
66
|
-
tzinfo (~> 0.3.22)
|
67
|
-
moped (1.4.5)
|
68
|
-
multi_json (1.7.3)
|
69
|
-
multipart-post (1.2.0)
|
70
|
-
nokogiri (1.5.9)
|
71
|
-
oauth2 (0.8.1)
|
72
|
-
faraday (~> 0.8)
|
73
|
-
httpauth (~> 0.1)
|
74
|
-
jwt (~> 0.1.4)
|
75
|
-
multi_json (~> 1.0)
|
76
|
-
rack (~> 1.2)
|
77
|
-
omniauth (1.0.3)
|
78
|
-
hashie (~> 1.2)
|
79
|
-
rack
|
80
|
-
omniauth-facebook (1.4.0)
|
81
|
-
omniauth-oauth2 (~> 1.0.2)
|
82
|
-
omniauth-oauth2 (1.0.3)
|
83
|
-
oauth2 (~> 0.8.0)
|
84
|
-
omniauth (~> 1.0)
|
85
|
-
omniauth-openid (1.0.1)
|
86
|
-
omniauth (~> 1.0)
|
87
|
-
rack-openid (~> 1.3.1)
|
88
|
-
origin (1.1.0)
|
89
|
-
orm_adapter (0.4.0)
|
90
|
-
polyglot (0.3.3)
|
91
|
-
rack (1.4.5)
|
92
|
-
rack-cache (1.2)
|
93
|
-
rack (>= 0.4)
|
94
|
-
rack-openid (1.3.1)
|
95
|
-
rack (>= 1.1.0)
|
96
|
-
ruby-openid (>= 2.1.8)
|
97
|
-
rack-ssl (1.3.3)
|
98
|
-
rack
|
99
|
-
rack-test (0.6.2)
|
100
|
-
rack (>= 1.0)
|
101
|
-
rails (3.2.13)
|
102
|
-
actionmailer (= 3.2.13)
|
103
|
-
actionpack (= 3.2.13)
|
104
|
-
activerecord (= 3.2.13)
|
105
|
-
activeresource (= 3.2.13)
|
106
|
-
activesupport (= 3.2.13)
|
107
|
-
bundler (~> 1.0)
|
108
|
-
railties (= 3.2.13)
|
109
|
-
railties (3.2.13)
|
110
|
-
actionpack (= 3.2.13)
|
111
|
-
activesupport (= 3.2.13)
|
112
|
-
rack-ssl (~> 1.3.2)
|
113
|
-
rake (>= 0.8.7)
|
114
|
-
rdoc (~> 3.4)
|
115
|
-
thor (>= 0.14.6, < 2.0)
|
116
|
-
rake (10.0.4)
|
117
|
-
rdoc (3.12.2)
|
118
|
-
json (~> 1.4)
|
119
|
-
ruby-openid (2.2.3)
|
120
|
-
sprockets (2.2.2)
|
121
|
-
hike (~> 1.2)
|
122
|
-
multi_json (~> 1.0)
|
123
|
-
rack (~> 1.0)
|
124
|
-
tilt (~> 1.1, != 1.3.0)
|
125
|
-
sqlite3 (1.3.7)
|
126
|
-
thor (0.18.1)
|
127
|
-
tilt (1.4.0)
|
128
|
-
treetop (1.4.12)
|
129
|
-
polyglot
|
130
|
-
polyglot (>= 0.3.1)
|
131
|
-
tzinfo (0.3.37)
|
132
|
-
warden (1.2.1)
|
133
|
-
rack (>= 1.0)
|
134
|
-
webrat (0.7.3)
|
135
|
-
nokogiri (>= 1.2.0)
|
136
|
-
rack (>= 1.0)
|
137
|
-
rack-test (>= 0.5.3)
|
138
|
-
|
139
|
-
PLATFORMS
|
140
|
-
ruby
|
141
|
-
|
142
|
-
DEPENDENCIES
|
143
|
-
activerecord-jdbc-adapter
|
144
|
-
activerecord-jdbcsqlite3-adapter
|
145
|
-
devise!
|
146
|
-
jruby-openssl
|
147
|
-
mocha (~> 0.13.1)
|
148
|
-
mongoid (~> 3.0)
|
149
|
-
omniauth (~> 1.0.0)
|
150
|
-
omniauth-facebook
|
151
|
-
omniauth-oauth2 (~> 1.0.0)
|
152
|
-
omniauth-openid (~> 1.0.1)
|
153
|
-
rails (~> 3.2.6)
|
154
|
-
rdoc
|
155
|
-
sqlite3
|
156
|
-
webrat (= 0.7.3)
|
@@ -1,89 +0,0 @@
|
|
1
|
-
require 'devise/strategies/token_authenticatable'
|
2
|
-
|
3
|
-
module Devise
|
4
|
-
module Models
|
5
|
-
# The TokenAuthenticatable module is responsible for generating an authentication token and
|
6
|
-
# validating the authenticity of the same while signing in.
|
7
|
-
#
|
8
|
-
# This module only provides a few helpers to help you manage the token, but it is up to you
|
9
|
-
# to choose how to use it. For example, if you want to have a new token every time the user
|
10
|
-
# saves his account, you can do the following:
|
11
|
-
#
|
12
|
-
# before_save :reset_authentication_token
|
13
|
-
#
|
14
|
-
# On the other hand, if you want to generate token unless one exists, you should use instead:
|
15
|
-
#
|
16
|
-
# before_save :ensure_authentication_token
|
17
|
-
#
|
18
|
-
# If you want to delete the token after it is used, you can do so in the
|
19
|
-
# after_token_authentication callback.
|
20
|
-
#
|
21
|
-
# == APIs
|
22
|
-
#
|
23
|
-
# If you are using token authentication with APIs and using trackable. Every
|
24
|
-
# request will be considered as a new sign in (since there is no session in
|
25
|
-
# APIs). You can disable this by creating a before filter as follow:
|
26
|
-
#
|
27
|
-
# before_filter :skip_trackable
|
28
|
-
#
|
29
|
-
# def skip_trackable
|
30
|
-
# request.env['devise.skip_trackable'] = true
|
31
|
-
# end
|
32
|
-
#
|
33
|
-
# == Options
|
34
|
-
#
|
35
|
-
# TokenAuthenticatable adds the following options to devise_for:
|
36
|
-
#
|
37
|
-
# * +token_authentication_key+: Defines name of the authentication token params key. E.g. /users/sign_in?some_key=...
|
38
|
-
#
|
39
|
-
module TokenAuthenticatable
|
40
|
-
extend ActiveSupport::Concern
|
41
|
-
|
42
|
-
def self.required_fields(klass)
|
43
|
-
[:authentication_token]
|
44
|
-
end
|
45
|
-
|
46
|
-
# Generate new authentication token (a.k.a. "single access token").
|
47
|
-
def reset_authentication_token
|
48
|
-
self.authentication_token = self.class.authentication_token
|
49
|
-
end
|
50
|
-
|
51
|
-
# Generate new authentication token and save the record.
|
52
|
-
def reset_authentication_token!
|
53
|
-
reset_authentication_token
|
54
|
-
save(:validate => false)
|
55
|
-
end
|
56
|
-
|
57
|
-
# Generate authentication token unless already exists.
|
58
|
-
def ensure_authentication_token
|
59
|
-
reset_authentication_token if authentication_token.blank?
|
60
|
-
end
|
61
|
-
|
62
|
-
# Generate authentication token unless already exists and save the record.
|
63
|
-
def ensure_authentication_token!
|
64
|
-
reset_authentication_token! if authentication_token.blank?
|
65
|
-
end
|
66
|
-
|
67
|
-
# Hook called after token authentication.
|
68
|
-
def after_token_authentication
|
69
|
-
end
|
70
|
-
|
71
|
-
def expire_auth_token_on_timeout
|
72
|
-
self.class.expire_auth_token_on_timeout
|
73
|
-
end
|
74
|
-
|
75
|
-
module ClassMethods
|
76
|
-
def find_for_token_authentication(conditions)
|
77
|
-
find_for_authentication(:authentication_token => conditions[token_authentication_key])
|
78
|
-
end
|
79
|
-
|
80
|
-
# Generate a token checking if one does not already exist in the database.
|
81
|
-
def authentication_token
|
82
|
-
generate_token(:authentication_token)
|
83
|
-
end
|
84
|
-
|
85
|
-
Devise::Models.config(self, :token_authentication_key, :expire_auth_token_on_timeout)
|
86
|
-
end
|
87
|
-
end
|
88
|
-
end
|
89
|
-
end
|
@@ -1,91 +0,0 @@
|
|
1
|
-
require 'devise/strategies/base'
|
2
|
-
|
3
|
-
module Devise
|
4
|
-
module Strategies
|
5
|
-
# Strategy for signing in a user, based on a authenticatable token. This works for both params
|
6
|
-
# and http. For the former, all you need to do is to pass the params in the URL:
|
7
|
-
#
|
8
|
-
# http://myapp.example.com/?user_token=SECRET
|
9
|
-
#
|
10
|
-
# For headers, you can use basic authentication passing the token as username and
|
11
|
-
# blank password. Since some clients may require a password, you can pass "X" as
|
12
|
-
# password and it will simply be ignored.
|
13
|
-
#
|
14
|
-
# You may also pass the token using the Token authentication mechanism provided
|
15
|
-
# by Rails: http://api.rubyonrails.org/classes/ActionController/HttpAuthentication/Token.html
|
16
|
-
# The token options are stored in request.env['devise.token_options']
|
17
|
-
class TokenAuthenticatable < Authenticatable
|
18
|
-
def store?
|
19
|
-
super && !mapping.to.skip_session_storage.include?(:token_auth)
|
20
|
-
end
|
21
|
-
|
22
|
-
def valid?
|
23
|
-
super || valid_for_token_auth?
|
24
|
-
end
|
25
|
-
|
26
|
-
def authenticate!
|
27
|
-
resource = mapping.to.find_for_token_authentication(authentication_hash)
|
28
|
-
return fail(:invalid_token) unless resource
|
29
|
-
|
30
|
-
if validate(resource)
|
31
|
-
resource.after_token_authentication
|
32
|
-
success!(resource)
|
33
|
-
end
|
34
|
-
end
|
35
|
-
|
36
|
-
private
|
37
|
-
|
38
|
-
# Token Authenticatable can be authenticated with params in any controller and any verb.
|
39
|
-
def valid_params_request?
|
40
|
-
true
|
41
|
-
end
|
42
|
-
|
43
|
-
# Do not use remember_me behavior with token.
|
44
|
-
def remember_me?
|
45
|
-
false
|
46
|
-
end
|
47
|
-
|
48
|
-
# Check if the model accepts this strategy as token authenticatable.
|
49
|
-
def token_authenticatable?
|
50
|
-
mapping.to.http_authenticatable?(:token_options)
|
51
|
-
end
|
52
|
-
|
53
|
-
# Check if this is strategy is valid for token authentication by:
|
54
|
-
#
|
55
|
-
# * Validating if the model allows http token authentication;
|
56
|
-
# * If the http auth token exists;
|
57
|
-
# * If all authentication keys are present;
|
58
|
-
#
|
59
|
-
def valid_for_token_auth?
|
60
|
-
token_authenticatable? && auth_token.present? && with_authentication_hash(:token_auth, token_auth_hash)
|
61
|
-
end
|
62
|
-
|
63
|
-
# Extract the auth token from the request
|
64
|
-
def auth_token
|
65
|
-
@auth_token ||= ActionController::HttpAuthentication::Token.token_and_options(request)
|
66
|
-
end
|
67
|
-
|
68
|
-
# Extract a hash with attributes:values from the auth_token
|
69
|
-
def token_auth_hash
|
70
|
-
request.env['devise.token_options'] = auth_token.last
|
71
|
-
{ authentication_keys.first => auth_token.first }
|
72
|
-
end
|
73
|
-
|
74
|
-
# Try both scoped and non scoped keys
|
75
|
-
def params_auth_hash
|
76
|
-
if params[scope].kind_of?(Hash) && params[scope].has_key?(authentication_keys.first)
|
77
|
-
params[scope]
|
78
|
-
else
|
79
|
-
params
|
80
|
-
end
|
81
|
-
end
|
82
|
-
|
83
|
-
# Overwrite authentication keys to use token_authentication_key.
|
84
|
-
def authentication_keys
|
85
|
-
@authentication_keys ||= [mapping.to.token_authentication_key]
|
86
|
-
end
|
87
|
-
end
|
88
|
-
end
|
89
|
-
end
|
90
|
-
|
91
|
-
Warden::Strategies.add(:token_authenticatable, Devise::Strategies::TokenAuthenticatable)
|