loyal_devise 2.1.2 → 2.1.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (188) hide show
  1. data/.gitignore +2 -0
  2. data/.travis.yml +14 -9
  3. data/.yardopts +9 -0
  4. data/CHANGELOG.rdoc +60 -5
  5. data/CONTRIBUTING.md +4 -2
  6. data/Gemfile +7 -7
  7. data/Gemfile.lock +107 -101
  8. data/MIT-LICENSE +1 -1
  9. data/README.md +110 -48
  10. data/Rakefile +1 -0
  11. data/app/controllers/devise/confirmations_controller.rb +2 -4
  12. data/app/controllers/devise/omniauth_callbacks_controller.rb +0 -1
  13. data/app/controllers/devise/passwords_controller.rb +16 -5
  14. data/app/controllers/devise/registrations_controller.rb +13 -7
  15. data/app/controllers/devise/sessions_controller.rb +6 -6
  16. data/app/controllers/devise/unlocks_controller.rb +3 -4
  17. data/app/controllers/devise_controller.rb +12 -33
  18. data/app/helpers/devise_helper.rb +0 -1
  19. data/app/mailers/devise/mailer.rb +7 -8
  20. data/app/views/devise/mailer/confirmation_instructions.html.erb +1 -1
  21. data/app/views/devise/mailer/reset_password_instructions.html.erb +1 -1
  22. data/app/views/devise/registrations/edit.html.erb +5 -1
  23. data/config/locales/en.yml +48 -48
  24. data/devise.gemspec +6 -6
  25. data/devise.png +0 -0
  26. data/gemfiles/{Gemfile.rails-3.1.x → Gemfile.rails-3.2.x} +8 -12
  27. data/gemfiles/Gemfile.rails-3.2.x.lock +156 -0
  28. data/lib/devise.rb +34 -11
  29. data/lib/devise/controllers/helpers.rb +33 -7
  30. data/lib/devise/controllers/rememberable.rb +6 -3
  31. data/lib/devise/controllers/scoped_views.rb +1 -2
  32. data/lib/devise/controllers/url_helpers.rb +0 -1
  33. data/lib/devise/delegator.rb +0 -1
  34. data/lib/devise/failure_app.rb +8 -2
  35. data/lib/devise/hooks/activatable.rb +1 -2
  36. data/lib/devise/hooks/forgetable.rb +0 -1
  37. data/lib/devise/hooks/lockable.rb +1 -2
  38. data/lib/devise/hooks/rememberable.rb +1 -2
  39. data/lib/devise/hooks/timeoutable.rb +0 -1
  40. data/lib/devise/hooks/trackable.rb +0 -1
  41. data/lib/devise/mailers/helpers.rb +18 -14
  42. data/lib/devise/mapping.rb +6 -7
  43. data/lib/devise/models.rb +0 -1
  44. data/lib/devise/models/authenticatable.rb +50 -27
  45. data/lib/devise/models/confirmable.rb +37 -16
  46. data/lib/devise/models/database_authenticatable.rb +17 -3
  47. data/lib/devise/models/lockable.rb +1 -2
  48. data/lib/devise/models/omniauthable.rb +1 -2
  49. data/lib/devise/models/recoverable.rb +10 -6
  50. data/lib/devise/models/registerable.rb +0 -1
  51. data/lib/devise/models/rememberable.rb +1 -2
  52. data/lib/devise/models/timeoutable.rb +1 -2
  53. data/lib/devise/models/token_authenticatable.rb +0 -1
  54. data/lib/devise/models/trackable.rb +0 -1
  55. data/lib/devise/models/validatable.rb +0 -1
  56. data/lib/devise/modules.rb +1 -2
  57. data/lib/devise/omniauth.rb +0 -1
  58. data/lib/devise/omniauth/config.rb +0 -1
  59. data/lib/devise/omniauth/url_helpers.rb +0 -1
  60. data/lib/devise/orm/active_record.rb +1 -2
  61. data/lib/devise/orm/mongoid.rb +1 -2
  62. data/lib/devise/{param_filter.rb → parameter_filter.rb} +10 -12
  63. data/lib/devise/parameter_sanitizer.rb +59 -0
  64. data/lib/devise/rails.rb +0 -1
  65. data/lib/devise/rails/routes.rb +22 -18
  66. data/lib/devise/rails/warden_compat.rb +0 -30
  67. data/lib/devise/strategies/authenticatable.rb +8 -6
  68. data/lib/devise/strategies/base.rb +1 -2
  69. data/lib/devise/strategies/database_authenticatable.rb +1 -2
  70. data/lib/devise/strategies/rememberable.rb +1 -2
  71. data/lib/devise/strategies/token_authenticatable.rb +38 -4
  72. data/lib/devise/test_helpers.rb +0 -1
  73. data/lib/devise/time_inflector.rb +1 -2
  74. data/lib/devise/version.rb +1 -2
  75. data/lib/generators/active_record/devise_generator.rb +1 -5
  76. data/lib/generators/active_record/templates/migration.rb +0 -1
  77. data/lib/generators/active_record/templates/migration_existing.rb +0 -1
  78. data/lib/generators/devise/devise_generator.rb +0 -1
  79. data/lib/generators/devise/install_generator.rb +0 -1
  80. data/lib/generators/devise/orm_helpers.rb +1 -2
  81. data/lib/generators/devise/views_generator.rb +8 -3
  82. data/lib/generators/mongoid/devise_generator.rb +1 -2
  83. data/lib/generators/templates/README +1 -1
  84. data/lib/generators/templates/devise.rb +10 -5
  85. data/lib/generators/templates/markerb/confirmation_instructions.markerb +1 -1
  86. data/lib/generators/templates/simple_form_for/confirmations/new.html.erb +1 -0
  87. data/lib/generators/templates/simple_form_for/registrations/edit.html.erb +6 -1
  88. data/lib/generators/templates/simple_form_for/unlocks/new.html.erb +1 -0
  89. data/loyal_devise.gemspec +27 -0
  90. data/test/controllers/custom_strategy_test.rb +0 -1
  91. data/test/controllers/helpers_test.rb +0 -1
  92. data/test/controllers/internal_helpers_test.rb +13 -4
  93. data/test/controllers/passwords_controller_test.rb +32 -0
  94. data/test/controllers/sessions_controller_test.rb +28 -1
  95. data/test/controllers/url_helpers_test.rb +0 -1
  96. data/test/delegator_test.rb +0 -1
  97. data/test/devise_test.rb +12 -2
  98. data/test/failure_app_test.rb +3 -4
  99. data/test/generators/active_record_generator_test.rb +1 -4
  100. data/test/generators/devise_generator_test.rb +0 -1
  101. data/test/generators/install_generator_test.rb +0 -1
  102. data/test/generators/mongoid_generator_test.rb +0 -1
  103. data/test/generators/views_generator_test.rb +16 -2
  104. data/test/helpers/devise_helper_test.rb +1 -2
  105. data/test/integration/authenticatable_test.rb +92 -27
  106. data/test/integration/confirmable_test.rb +7 -7
  107. data/test/integration/database_authenticatable_test.rb +8 -7
  108. data/test/integration/http_authenticatable_test.rb +19 -2
  109. data/test/integration/lockable_test.rb +1 -2
  110. data/test/integration/omniauthable_test.rb +2 -3
  111. data/test/integration/recoverable_test.rb +40 -12
  112. data/test/integration/registerable_test.rb +17 -14
  113. data/test/integration/rememberable_test.rb +16 -10
  114. data/test/integration/timeoutable_test.rb +11 -2
  115. data/test/integration/token_authenticatable_test.rb +45 -2
  116. data/test/integration/trackable_test.rb +1 -2
  117. data/test/mailers/confirmation_instructions_test.rb +11 -3
  118. data/test/mailers/reset_password_instructions_test.rb +11 -3
  119. data/test/mailers/unlock_instructions_test.rb +11 -2
  120. data/test/mapping_test.rb +0 -1
  121. data/test/models/authenticatable_test.rb +6 -1
  122. data/test/models/confirmable_test.rb +53 -2
  123. data/test/models/database_authenticatable_test.rb +57 -21
  124. data/test/models/lockable_test.rb +1 -2
  125. data/test/models/omniauthable_test.rb +0 -1
  126. data/test/models/recoverable_test.rb +21 -5
  127. data/test/models/registerable_test.rb +0 -1
  128. data/test/models/rememberable_test.rb +4 -4
  129. data/test/models/serializable_test.rb +8 -8
  130. data/test/models/timeoutable_test.rb +0 -1
  131. data/test/models/token_authenticatable_test.rb +0 -1
  132. data/test/models/trackable_test.rb +0 -1
  133. data/test/models/validatable_test.rb +16 -6
  134. data/test/models_test.rb +7 -24
  135. data/test/omniauth/config_test.rb +1 -2
  136. data/test/omniauth/url_helpers_test.rb +4 -2
  137. data/test/orm/active_record.rb +1 -1
  138. data/test/orm/mongoid.rb +2 -4
  139. data/test/parameter_sanitizer_test.rb +51 -0
  140. data/test/rails_app/Rakefile +0 -4
  141. data/test/rails_app/app/active_record/admin.rb +0 -1
  142. data/test/rails_app/app/active_record/shim.rb +1 -2
  143. data/test/rails_app/app/active_record/user.rb +0 -1
  144. data/test/rails_app/app/controllers/admins/sessions_controller.rb +1 -2
  145. data/test/rails_app/app/controllers/admins_controller.rb +0 -1
  146. data/test/rails_app/app/controllers/application_controller.rb +1 -1
  147. data/test/rails_app/app/controllers/home_controller.rb +0 -1
  148. data/test/rails_app/app/controllers/publisher/registrations_controller.rb +1 -2
  149. data/test/rails_app/app/controllers/publisher/sessions_controller.rb +1 -2
  150. data/test/rails_app/app/controllers/users/omniauth_callbacks_controller.rb +1 -2
  151. data/test/rails_app/app/controllers/users_controller.rb +8 -1
  152. data/test/rails_app/app/helpers/application_helper.rb +0 -1
  153. data/test/rails_app/app/mailers/users/mailer.rb +4 -1
  154. data/test/rails_app/app/mongoid/admin.rb +4 -3
  155. data/test/rails_app/app/mongoid/shim.rb +3 -5
  156. data/test/rails_app/app/mongoid/user.rb +2 -3
  157. data/test/rails_app/app/views/users/edit_form.html.erb +1 -0
  158. data/test/rails_app/bin/bundle +3 -0
  159. data/test/rails_app/bin/rails +4 -0
  160. data/test/rails_app/bin/rake +4 -0
  161. data/test/rails_app/config/application.rb +1 -3
  162. data/test/rails_app/config/boot.rb +3 -4
  163. data/test/rails_app/config/environment.rb +2 -3
  164. data/test/rails_app/config/environments/development.rb +23 -8
  165. data/test/rails_app/config/environments/production.rb +68 -18
  166. data/test/rails_app/config/environments/test.rb +18 -16
  167. data/test/rails_app/config/initializers/backtrace_silencers.rb +0 -1
  168. data/test/rails_app/config/initializers/devise.rb +0 -1
  169. data/test/rails_app/config/initializers/inflections.rb +0 -1
  170. data/test/rails_app/config/initializers/secret_token.rb +8 -3
  171. data/test/rails_app/config/initializers/session_store.rb +1 -0
  172. data/test/rails_app/config/routes.rb +20 -17
  173. data/test/rails_app/db/migrate/20100401102949_create_tables.rb +0 -1
  174. data/test/rails_app/db/schema.rb +0 -1
  175. data/test/rails_app/lib/shared_admin.rb +0 -1
  176. data/test/rails_app/lib/shared_user.rb +0 -2
  177. data/test/routes_test.rb +22 -21
  178. data/test/support/assertions.rb +0 -1
  179. data/test/support/helpers.rb +1 -2
  180. data/test/support/integration.rb +0 -1
  181. data/test/support/webrat/integrations/rails.rb +0 -1
  182. data/test/test_helper.rb +8 -2
  183. data/test/test_helpers_test.rb +0 -1
  184. data/test/test_models.rb +26 -0
  185. metadata +65 -27
  186. data/gemfiles/Gemfile.rails-3.1.x.lock +0 -167
  187. data/test/indifferent_hash.rb +0 -34
  188. data/test/rails_app/script/rails +0 -10
data/.gitignore CHANGED
@@ -8,3 +8,5 @@ rdoc/*
8
8
  pkg
9
9
  log
10
10
  test/tmp/*
11
+
12
+ /**.gem
@@ -1,15 +1,20 @@
1
+ language: ruby
1
2
  script: "bundle exec rake test"
2
3
  rvm:
3
- - 1.8.7
4
- - 1.9.2
5
4
  - 1.9.3
6
- - ree
5
+ - 2.0.0
6
+ env:
7
+ - DEVISE_ORM=mongoid
8
+ - DEVISE_ORM=active_record
7
9
  gemfile:
8
- - gemfiles/Gemfile.rails-3.1.x
10
+ - gemfiles/Gemfile.rails-3.2.x
9
11
  - Gemfile
12
+ services:
13
+ - mongodb
10
14
  notifications:
11
- recipients:
12
- - jose.valim@plataformatec.com.br
13
- - carlos@plataformatec.com.br
14
- - rodrigo.flores@plataformatec.com.br
15
- - rafael.franca@plataformatec.com.br
15
+ email: false
16
+ campfire:
17
+ on_success: change
18
+ on_failure: always
19
+ rooms:
20
+ - secure: "TRiqvuM4i/QmRDWjUSNitE5/P91BOzDkNl53+bZjjtxcISCswZtmECWBR7n9\n3xwqCOU1o2lfohxZ32OHOj/Nj7o+90zWJfWxcv+if0hIXRiil62M5pg0lZUd\nyJ4M5VQ0lSWo5he1OUrXhSabPJeaK3B8yT/tdh+qO5yzR+vb/jc="
@@ -0,0 +1,9 @@
1
+ --protected
2
+ --no-private
3
+ --embed-mixin ClassMethods
4
+ -
5
+ README.md
6
+ CHANGELOG.rdoc
7
+ CONTRIBUTING.md
8
+ MIT-LICENSE
9
+
@@ -1,18 +1,73 @@
1
- * enhancement
2
- * Default minimum password length is now 8 (by @carlosgaldino).
1
+ == 3.0.0.rc
2
+
3
+ * enhancements
4
+ * Rails 4 and Strong Parameters compatibility. (@carlosantoniodasilva, @josevalim, @latortuga, @lucasmazza, @nashby, @rafaelfranca, @spastorino)
5
+ * Drop support for Rails < 3.2 and Ruby < 1.9.3.
6
+
7
+ == 2.2.4
8
+
9
+ * enhancements
10
+ * Add `destroy_with_password` to `DatabaseAuthenticatable`. Allows destroying a record when `:current_password` matches, similarly to how `update_with_password` works. (by @michiel3)
11
+ * Allow to override path after password resetting (by @worker8)
12
+ * Add `#skip_confirmation_notification!` method to `Confirmable`. Allows skipping confirmation email without auto-confirming. (by @gregates)
13
+ * allow_unconfirmed_access_for config from `:confirmable` module can be set to `nil` that means unconfirmed access for unlimited time. (by @nashby)
14
+ * Support Rails' token strategy on authentication (by @robhurring)
15
+ * Support explicitly setting the http authentication key via `config.http_authentication_key` (by @neo)
16
+
17
+ * bug fix
18
+ * Do not redirect when accessing devise API via JSON. (by @sebastianwr)
19
+ * Generating scoped devise views now uses the correct scoped shared links partial instead of the default devise one (by @nashby)
20
+ * Fix inheriting mailer templates from `Devise::Mailer`
21
+ * Fix a bug when procs are used as default mailer in Devise (by @tomasv)
22
+
23
+ == 2.2.3
24
+
25
+ Security announcement: http://blog.plataformatec.com.br/2013/01/security-announcement-devise-v2-2-3-v2-1-3-v2-0-5-and-v1-5-3-released/
26
+
27
+ * bug fix
28
+ * Require string conversion for all values
29
+
30
+ == 2.2.2
31
+
32
+ * bug fix
33
+ * Fix bug when checking for reconfirmable in templates
34
+
35
+ == 2.2.1
36
+
37
+ * bug fix
38
+ * Fix regression with case_insensitive_keys
39
+ * Fix regression when password is blank when it is invalid
40
+
41
+ == 2.2.0
42
+
43
+ * backwards incompatible changes
44
+ * `headers_for` is deprecated, customize the mailer directly instead
45
+ * All mailer methods now expect a second argument with delivery options
46
+ * Default minimum password length is now 8 (by @carlosgaldino)
47
+ * Support alternate sign in error message when email record does not exist (this adds a new I18n key to the locale file) (by @gabetax)
48
+ * DeviseController responds only to HTML requests by default (call `DeviseController.respond_to` or `ApplicationController.respond_to` to add new formats)
49
+ * Support Mongoid 3 onwards (by @durran)
50
+
51
+ * enhancements
52
+ * Fix unlockable which could leak account existence on paranoid mode (by @latortuga)
3
53
  * Confirmable now has a confirm_within option to set a period while the confirmation token is still valid (by @promisedlandt)
4
- * Make #set_flash_message respect i18n-set resource_name (by @latortuga)
54
+ * Flash messages in controller now respects `resource_name` (by @latortuga)
5
55
  * Separate `sign_in` and `sign_up` on RegistrationsController (by @rubynortheast)
6
56
  * Add autofocus to default views (by @Radagaisus)
57
+ * Unlock user on password reset (by @marcinb)
58
+ * Allow validation callbacks to apply to virtual attributes (by @latortuga)
7
59
 
8
60
  * bug fix
61
+ * unconfirmed_email now uses the proper e-mail on salutation
62
+ * Fix default email_regexp config to not allow spaces (by @kukula)
9
63
  * Fix a regression introduced on warden 1.2.1 (by @ejfinneran)
10
64
  * Properly camelize omniauth strategies (by @saizai)
11
65
  * Do not set flash messages for non navigational requests on session sign out (by @mathieul)
12
66
  * Set the proper fields as required on the lockable module (by @nickhoffman)
13
67
  * Respects Devise mailer default's reply_to (by @mrchrisadams)
14
- * Properly assign resource on sign_in action (by @adammcnamara)
15
- * Unlockable could leak account existence on paranoid mode (by @latortuga)
68
+ * Properly assign resource on `sign_in` related action (by @adammcnamara)
69
+ * `update_with_password` doesn't change encrypted password when it is invalid (by @nashby)
70
+ * Properly handle namespaced models on Active Record generator (by @nashby)
16
71
 
17
72
  == 2.1.2
18
73
 
@@ -4,9 +4,11 @@
4
4
 
5
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
6
 
7
- 3) Do a small search on the issues tracker before submitting your issue to see if it was already reported / fixed. In case it was not, create your report including Rails, Devise and Warden versions. If you are getting exceptions, please include the full backtrace.
7
+ 3) Do a small search on the issues tracker before submitting your issue to see if it was already reported / fixed.
8
8
 
9
- That's it! The more information you give, the more easy it becomes for us to track it down and fix it.
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.
10
12
  Ideally, you should provide an application that reproduces the error or a test case to Devise's suite.
11
13
 
12
14
  Thanks!
data/Gemfile CHANGED
@@ -1,8 +1,8 @@
1
- source "http://rubygems.org"
1
+ source "https://rubygems.org"
2
2
 
3
3
  gemspec
4
4
 
5
- gem "rails", "~> 3.2.6"
5
+ gem "rails", "~> 4.0.0.rc1"
6
6
  gem "omniauth", "~> 1.0.0"
7
7
  gem "omniauth-oauth2", "~> 1.0.0"
8
8
  gem "rdoc"
@@ -10,8 +10,8 @@ gem "rdoc"
10
10
  group :test do
11
11
  gem "omniauth-facebook"
12
12
  gem "omniauth-openid", "~> 1.0.1"
13
- gem "webrat", "0.7.2", :require => false
14
- gem "mocha", :require => false
13
+ gem "webrat", "0.7.3", :require => false
14
+ gem "mocha", "~> 0.13.1", :require => false
15
15
  end
16
16
 
17
17
  platforms :jruby do
@@ -22,10 +22,10 @@ end
22
22
 
23
23
  platforms :ruby do
24
24
  gem "sqlite3"
25
+ end
25
26
 
27
+ platforms :mri_19, :mri_20 do
26
28
  group :mongoid do
27
- gem "mongo", "~> 1.3.0"
28
- gem "mongoid", "~> 2.0"
29
- gem "bson_ext", "~> 1.3.0"
29
+ gem "mongoid", github: "mongoid/mongoid", branch: "master"
30
30
  end
31
31
  end
@@ -1,133 +1,141 @@
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
+
1
12
  PATH
2
13
  remote: .
3
14
  specs:
4
- loyal_devise (2.1.2)
15
+ devise (3.0.0.rc)
5
16
  bcrypt-ruby (~> 3.0)
6
- loyal_warden (~> 2.0.0)
7
17
  orm_adapter (~> 0.1)
18
+ railties (>= 3.2.6, < 5)
19
+ warden (~> 1.2.1)
8
20
 
9
21
  GEM
10
- remote: http://rubygems.org/
22
+ remote: https://rubygems.org/
11
23
  specs:
12
- actionmailer (3.2.6)
13
- actionpack (= 3.2.6)
14
- mail (~> 2.4.4)
15
- actionpack (3.2.6)
16
- activemodel (= 3.2.6)
17
- activesupport (= 3.2.6)
18
- builder (~> 3.0.0)
24
+ actionmailer (4.0.0.rc1)
25
+ actionpack (= 4.0.0.rc1)
26
+ mail (~> 2.5.3)
27
+ actionpack (4.0.0.rc1)
28
+ activesupport (= 4.0.0.rc1)
29
+ builder (~> 3.1.0)
19
30
  erubis (~> 2.7.0)
20
- journey (~> 1.0.1)
21
- rack (~> 1.4.0)
22
- rack-cache (~> 1.2)
23
- rack-test (~> 0.6.1)
24
- sprockets (~> 2.1.3)
25
- activemodel (3.2.6)
26
- activesupport (= 3.2.6)
27
- builder (~> 3.0.0)
28
- activerecord (3.2.6)
29
- activemodel (= 3.2.6)
30
- activesupport (= 3.2.6)
31
- arel (~> 3.0.2)
32
- tzinfo (~> 0.3.29)
33
- activeresource (3.2.6)
34
- activemodel (= 3.2.6)
35
- activesupport (= 3.2.6)
36
- activesupport (3.2.6)
37
- i18n (~> 0.6)
38
- multi_json (~> 1.0)
39
- addressable (2.2.6)
40
- arel (3.0.2)
31
+ rack (~> 1.5.2)
32
+ rack-test (~> 0.6.2)
33
+ activemodel (4.0.0.rc1)
34
+ activesupport (= 4.0.0.rc1)
35
+ builder (~> 3.1.0)
36
+ activerecord (4.0.0.rc1)
37
+ activemodel (= 4.0.0.rc1)
38
+ activerecord-deprecated_finders (~> 1.0.2)
39
+ activesupport (= 4.0.0.rc1)
40
+ arel (~> 4.0.0)
41
+ activerecord-deprecated_finders (1.0.2)
42
+ activesupport (4.0.0.rc1)
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.8)
41
50
  bcrypt-ruby (3.0.1)
42
- bson (1.5.1)
43
- bson_ext (1.3.1)
44
- builder (3.0.0)
51
+ builder (3.1.4)
45
52
  erubis (2.7.0)
46
- faraday (0.7.5)
47
- addressable (~> 2.2.6)
48
- multipart-post (~> 1.1.3)
49
- rack (>= 1.1.0, < 2)
53
+ faraday (0.8.7)
54
+ multipart-post (~> 1.1)
50
55
  hashie (1.2.0)
51
- hike (1.2.1)
52
- i18n (0.6.0)
53
- journey (1.0.4)
54
- json (1.7.3)
55
- loyal_warden (2.0.0)
56
- rack (>= 1.0)
57
- mail (2.4.4)
56
+ hike (1.2.2)
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.3)
58
63
  i18n (>= 0.4.0)
59
64
  mime-types (~> 1.16)
60
65
  treetop (~> 1.4.8)
61
66
  metaclass (0.0.1)
62
- mime-types (1.18)
63
- mocha (0.10.0)
67
+ mime-types (1.23)
68
+ minitest (4.7.4)
69
+ mocha (0.13.3)
64
70
  metaclass (~> 0.0.1)
65
- mongo (1.3.1)
66
- bson (>= 1.3.1)
67
- mongoid (2.3.4)
68
- activemodel (~> 3.1)
69
- mongo (~> 1.3)
70
- tzinfo (~> 0.3.22)
71
- multi_json (1.0.4)
72
- multipart-post (1.1.4)
73
- nokogiri (1.5.0)
74
- oauth2 (0.5.1)
75
- faraday (~> 0.7.4)
76
- multi_json (~> 1.0.3)
77
- omniauth (1.0.1)
71
+ moped (1.4.5)
72
+ multi_json (1.7.2)
73
+ multipart-post (1.2.0)
74
+ nokogiri (1.5.9)
75
+ oauth2 (0.8.1)
76
+ faraday (~> 0.8)
77
+ httpauth (~> 0.1)
78
+ jwt (~> 0.1.4)
79
+ multi_json (~> 1.0)
80
+ rack (~> 1.2)
81
+ omniauth (1.0.3)
78
82
  hashie (~> 1.2)
79
83
  rack
80
- omniauth-facebook (1.0.0)
81
- omniauth-oauth2 (~> 1.0.0)
82
- omniauth-oauth2 (1.0.0)
83
- oauth2 (~> 0.5.0)
84
+ omniauth-facebook (1.4.0)
85
+ omniauth-oauth2 (~> 1.0.2)
86
+ omniauth-oauth2 (1.0.3)
87
+ oauth2 (~> 0.8.0)
84
88
  omniauth (~> 1.0)
85
89
  omniauth-openid (1.0.1)
86
90
  omniauth (~> 1.0)
87
91
  rack-openid (~> 1.3.1)
92
+ origin (1.1.0)
88
93
  orm_adapter (0.4.0)
89
94
  polyglot (0.3.3)
90
- rack (1.4.1)
91
- rack-cache (1.2)
92
- rack (>= 0.4)
95
+ rack (1.5.2)
93
96
  rack-openid (1.3.1)
94
97
  rack (>= 1.1.0)
95
98
  ruby-openid (>= 2.1.8)
96
- rack-ssl (1.3.2)
97
- rack
98
- rack-test (0.6.1)
99
+ rack-test (0.6.2)
99
100
  rack (>= 1.0)
100
- rails (3.2.6)
101
- actionmailer (= 3.2.6)
102
- actionpack (= 3.2.6)
103
- activerecord (= 3.2.6)
104
- activeresource (= 3.2.6)
105
- activesupport (= 3.2.6)
106
- bundler (~> 1.0)
107
- railties (= 3.2.6)
108
- railties (3.2.6)
109
- actionpack (= 3.2.6)
110
- activesupport (= 3.2.6)
111
- rack-ssl (~> 1.3.2)
101
+ rails (4.0.0.rc1)
102
+ actionmailer (= 4.0.0.rc1)
103
+ actionpack (= 4.0.0.rc1)
104
+ activerecord (= 4.0.0.rc1)
105
+ activesupport (= 4.0.0.rc1)
106
+ bundler (>= 1.3.0, < 2.0)
107
+ railties (= 4.0.0.rc1)
108
+ sprockets-rails (~> 2.0.0.rc4)
109
+ railties (4.0.0.rc1)
110
+ actionpack (= 4.0.0.rc1)
111
+ activesupport (= 4.0.0.rc1)
112
112
  rake (>= 0.8.7)
113
- rdoc (~> 3.4)
114
- thor (>= 0.14.6, < 2.0)
115
- rake (0.9.2.2)
116
- rdoc (3.12)
113
+ thor (>= 0.18.1, < 2.0)
114
+ rake (10.0.4)
115
+ rdoc (4.0.1)
117
116
  json (~> 1.4)
118
- ruby-openid (2.1.8)
119
- sprockets (2.1.3)
117
+ ruby-openid (2.2.3)
118
+ sprockets (2.9.3)
120
119
  hike (~> 1.2)
120
+ multi_json (~> 1.0)
121
121
  rack (~> 1.0)
122
122
  tilt (~> 1.1, != 1.3.0)
123
- sqlite3 (1.3.5)
124
- thor (0.15.2)
125
- tilt (1.3.3)
126
- treetop (1.4.10)
123
+ sprockets-rails (2.0.0.rc4)
124
+ actionpack (>= 3.0)
125
+ activesupport (>= 3.0)
126
+ sprockets (~> 2.8)
127
+ sqlite3 (1.3.7)
128
+ thor (0.18.1)
129
+ thread_safe (0.1.0)
130
+ atomic
131
+ tilt (1.4.0)
132
+ treetop (1.4.12)
127
133
  polyglot
128
134
  polyglot (>= 0.3.1)
129
- tzinfo (0.3.33)
130
- webrat (0.7.2)
135
+ tzinfo (0.3.37)
136
+ warden (1.2.1)
137
+ rack (>= 1.0)
138
+ webrat (0.7.3)
131
139
  nokogiri (>= 1.2.0)
132
140
  rack (>= 1.0)
133
141
  rack-test (>= 0.5.3)
@@ -138,17 +146,15 @@ PLATFORMS
138
146
  DEPENDENCIES
139
147
  activerecord-jdbc-adapter
140
148
  activerecord-jdbcsqlite3-adapter
141
- bson_ext (~> 1.3.0)
149
+ devise!
142
150
  jruby-openssl
143
- loyal_devise!
144
- mocha
145
- mongo (~> 1.3.0)
146
- mongoid (~> 2.0)
151
+ mocha (~> 0.13.1)
152
+ mongoid!
147
153
  omniauth (~> 1.0.0)
148
154
  omniauth-facebook
149
155
  omniauth-oauth2 (~> 1.0.0)
150
156
  omniauth-openid (~> 1.0.1)
151
- rails (~> 3.2.6)
157
+ rails (~> 4.0.0.rc1)
152
158
  rdoc
153
159
  sqlite3
154
- webrat (= 0.7.2)
160
+ webrat (= 0.7.3)
@@ -1,4 +1,4 @@
1
- Copyright 2009-2012 Plataformatec. http://plataformatec.com.br
1
+ Copyright 2009-2013 Plataformatec. http://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.md CHANGED
@@ -1,6 +1,10 @@
1
- ## Devise
1
+ ![Devise Logo](https://raw.github.com/plataformatec/devise/master/devise.png)
2
2
 
3
- [![Build Status](https://secure.travis-ci.org/plataformatec/devise.png)](http://travis-ci.org/plataformatec/devise) [![Code Climate](https://codeclimate.com/badge.png)](https://codeclimate.com/github/plataformatec/devise)
3
+ By [Plataformatec](http://plataformatec.com.br/).
4
+
5
+ [![Gem Version](https://fury-badge.herokuapp.com/rb/devise.png)](http://badge.fury.io/rb/devise)
6
+ [![Build Status](https://api.travis-ci.org/plataformatec/devise.png?branch=master)](http://travis-ci.org/plataformatec/devise)
7
+ [![Code Climate](https://codeclimate.com/github/plataformatec/devise.png)](https://codeclimate.com/github/plataformatec/devise)
4
8
 
5
9
  This README is [also available in a friendly navigable format](http://devise.plataformatec.com.br/).
6
10
 
@@ -11,7 +15,7 @@ Devise is a flexible authentication solution for Rails based on Warden. It:
11
15
  * Allows you to have multiple roles (or models/scopes) signed in at the same time;
12
16
  * Is based on a modularity concept: use just what you really need.
13
17
 
14
- It's composed of 12 modules:
18
+ It's composed of 11 modules:
15
19
 
16
20
  * [Database Authenticatable](http://rubydoc.info/github/plataformatec/devise/master/Devise/Models/DatabaseAuthenticatable): encrypts and stores a password in the database to validate the authenticity of a user while signing in. The authentication can be done both through POST requests or HTTP Basic Authentication.
17
21
  * [Token Authenticatable](http://rubydoc.info/github/plataformatec/devise/master/Devise/Models/TokenAuthenticatable): signs in a user based on an authentication token (also known as "single access token"). The token can be given both through query string or HTTP Basic Authentication.
@@ -53,7 +57,7 @@ You can view the Devise documentation in RDoc format here:
53
57
 
54
58
  http://rubydoc.info/github/plataformatec/devise/master/frames
55
59
 
56
- If you need to use Devise with Rails 2.3, you can always run "gem server" from the command line after you install the gem to access the old documentation.
60
+ If you need to use Devise with previous versions of Rails, you can always run "gem server" from the command line after you install the gem to access the old documentation.
57
61
 
58
62
  ### Example applications
59
63
 
@@ -86,7 +90,7 @@ Once you have solidified your understanding of Rails and authentication mechanis
86
90
 
87
91
  ## Getting started
88
92
 
89
- Devise 2.0 works with Rails 3.1 onwards. You can add it to your Gemfile with:
93
+ Devise 3.0 works with Rails 3.2 onwards. You can add it to your Gemfile with:
90
94
 
91
95
  ```ruby
92
96
  gem 'devise'
@@ -106,7 +110,7 @@ The generator will install an initializer which describes ALL Devise's configura
106
110
  rails generate devise MODEL
107
111
  ```
108
112
 
109
- 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 "rake 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 to point to the Devise controller.
113
+ 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 `rake 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 to point to the Devise controller.
110
114
 
111
115
  Note that you should re-start your app here if you've already started it. Otherwise you'll run into strange errors like users being unable to login and the route helpers being undefined.
112
116
 
@@ -139,7 +143,7 @@ user_session
139
143
  After signing in a user, confirming the account or updating the password, Devise will look for a scoped root path to redirect. Example: For a :user resource, it will use `user_root_path` if it exists, otherwise default `root_path` will be used. This means that you need to set the root inside your routes:
140
144
 
141
145
  ```ruby
142
- root :to => "home#index"
146
+ root to: "home#index"
143
147
  ```
144
148
 
145
149
  You can also overwrite `after_sign_in_path_for` and `after_sign_out_path_for` to customize your redirect hooks.
@@ -172,34 +176,57 @@ devise :database_authenticatable, :registerable, :confirmable, :recoverable, :st
172
176
 
173
177
  Besides :stretches, you can define :pepper, :encryptor, :confirm_within, :remember_for, :timeout_in, :unlock_in and other values. For details, see the initializer file that was created when you invoked the "devise:install" generator described above.
174
178
 
175
- ### Configuring multiple models
179
+ ### Strong Parameters
176
180
 
177
- Devise allows you to set up as many roles as you want. For example, you may have a User model and also want an Admin model with just authentication and timeoutable features. If so, just follow these steps:
181
+ When you customize your own views, you may end up adding new attributes to forms. Rails 4 moved the parameter sanitization from the model to the controller, causing Devise to handle this concern at the controller as well.
182
+
183
+ There are just three actions in Devise that allows any set of parameters to be passed down to the model, therefore requiring sanitization. Their names and the permited parameters by default are:
184
+
185
+ * `sign_in` (`Devise::SessionsController#new`) - Permits only the authentication keys (like `email`)
186
+ * `sign_up` (`Devise::RegistrationsController#create`) - Permits authentication keys plus `password` and `password_confirmation`
187
+ * `account_update` (`Devise::RegistrationsController#update`) - Permits authentication keys plus `password`, `password_confirmation` and `current_password`
188
+
189
+ In case you want to customize the permitted parameters (the lazy way™) you can do with a simple before filter in your `ApplicationController`:
178
190
 
179
191
  ```ruby
180
- # Create a migration with the required fields
181
- create_table :admins do |t|
182
- t.string :email
183
- t.string :encrypted_password
184
- t.timestamps
192
+ class ApplicationController < ActionController::Base
193
+ before_filter :configure_permitted_parameters, if: :devise_controller?
194
+
195
+ protected
196
+
197
+ def configure_permitted_parameters
198
+ devise_parameter_sanitizer.for(:sign_in) { |u| u.permit(:username, :email) }
199
+ end
185
200
  end
201
+ ```
186
202
 
187
- # Inside your Admin model
188
- devise :database_authenticatable, :timeoutable
203
+ If you have multiple roles, you may want to set up different parameter sanitizer per role. In this case, we recommend inheriting from `Devise::ParameterSanitizer` and add your own logic:
189
204
 
190
- # Inside your routes
191
- devise_for :admins
205
+ ```ruby
206
+ class User::ParameterSanitizer < Devise::ParameterSanitizer
207
+ def sign_in
208
+ default_params.permit(:username, :email)
209
+ end
210
+ end
211
+ ```
192
212
 
193
- # Inside your protected controller
194
- before_filter :authenticate_admin!
213
+ And then configure your controllers to use it:
195
214
 
196
- # Inside your controllers and views
197
- admin_signed_in?
198
- current_admin
199
- admin_session
215
+ ```ruby
216
+ class ApplicationController < ActionController::Base
217
+ protected
218
+
219
+ def devise_parameter_sanitizer
220
+ if resource_class.is_a?(User)
221
+ User::ParameterSanitizer.new(User, :user, params)
222
+ else
223
+ super # Use the default one
224
+ end
225
+ end
226
+ end
200
227
  ```
201
228
 
202
- On the other hand, you can simply run the generator!
229
+ The example above overrides the permitted parameters for the user to be both `:username` and `:email`. The non-lazy way to configure parameters would be by defining the before filter above in a custom controller. We detail how to configure and customize controllers in some sections below.
203
230
 
204
231
  ### Configuring views
205
232
 
@@ -223,29 +250,31 @@ rails generate devise:views users
223
250
 
224
251
  If the customization at the views level is not enough, you can customize each controller by following these steps:
225
252
 
226
- 1) Create your custom controller, for example a Admins::SessionsController:
253
+ 1. Create your custom controller, for example a `Admins::SessionsController`:
227
254
 
228
- ```ruby
229
- class Admins::SessionsController < Devise::SessionsController
230
- end
231
- ```
255
+ ```ruby
256
+ class Admins::SessionsController < Devise::SessionsController
257
+ end
258
+ ```
232
259
 
233
- 2) Tell the router to use this controller:
260
+ Note that in the above example, the controller needs to be created in the `app/controller/admins/` directory.
234
261
 
235
- ```ruby
236
- devise_for :admins, :controllers => { :sessions => "admins/sessions" }
237
- ```
262
+ 2. Tell the router to use this controller:
263
+
264
+ ```ruby
265
+ devise_for :admins, :controllers => { :sessions => "admins/sessions" }
266
+ ```
238
267
 
239
- 3) And since we changed the controller, it won't use the "devise/sessions" views, so remember to copy "devise/sessions" to "admin/sessions".
268
+ 3. And since we changed the controller, it won't use the `"devise/sessions"` views, so remember to copy `"devise/sessions"` to `"admin/sessions"`.
240
269
 
241
- Remember that Devise uses flash messages to let users know if sign in was successful or failed. Devise expects your application to call "flash[:notice]" and "flash[:alert]" as appropriate. Do not print the entire flash hash, print specific keys or at least remove the `:timedout` key from the hash as Devise adds this key in some circumstances, this key is not meant for display.
270
+ Remember that Devise uses flash messages to let users know if sign in was successful or failed. Devise expects your application to call `"flash[:notice]"` and `"flash[:alert]"` as appropriate. Do not print the entire flash hash, print specific keys or at least remove the `:timedout` key from the hash as Devise adds this key in some circumstances, this key is not meant for display.
242
271
 
243
272
  ### Configuring routes
244
273
 
245
274
  Devise also ships with default routes. If you need to customize them, you should probably be able to do it through the devise_for method. It accepts several options like :class_name, :path_prefix and so on, including the possibility to change path names for I18n:
246
275
 
247
276
  ```ruby
248
- devise_for :users, :path => "usuarios", :path_names => { :sign_in => 'login', :sign_out => 'logout', :password => 'secret', :confirmation => 'verification', :unlock => 'unblock', :registration => 'register', :sign_up => 'cmon_let_me_in' }
277
+ devise_for :users, :path => "auth", :path_names => { :sign_in => 'login', :sign_out => 'logout', :password => 'secret', :confirmation => 'verification', :unlock => 'unblock', :registration => 'register', :sign_up => 'cmon_let_me_in' }
249
278
  ```
250
279
 
251
280
  Be sure to check `devise_for` documentation for details.
@@ -330,28 +359,61 @@ sign_out @user # sign_out(resource)
330
359
 
331
360
  There are two things that is important to keep in mind:
332
361
 
333
- 1) These helpers are not going to work for integration tests driven by Capybara or Webrat. They are meant to be used with functional tests only. Instead, fill in the form or explicitly set the user in session;
362
+ 1. These helpers are not going to work for integration tests driven by Capybara or Webrat. They are meant to be used with functional tests only. Instead, fill in the form or explicitly set the user in session;
334
363
 
335
- 2) If you are testing Devise internal controllers or a controller that inherits from Devise's, you need to tell Devise which mapping should be used before a request. This is necessary because Devise gets this information from router, but since functional tests do not pass through the router, it needs to be told explicitly. For example, if you are testing the user scope, simply do:
364
+ 2. If you are testing Devise internal controllers or a controller that inherits from Devise's, you need to tell Devise which mapping should be used before a request. This is necessary because Devise gets this information from router, but since functional tests do not pass through the router, it needs to be told explicitly. For example, if you are testing the user scope, simply do:
336
365
 
366
+ ```ruby
337
367
  @request.env["devise.mapping"] = Devise.mappings[:user]
338
368
  get :new
369
+ ```
339
370
 
340
371
  ### Omniauth
341
372
 
342
- Devise comes with Omniauth support out of the box to authenticate from other providers. You can read more about Omniauth support in the wiki:
373
+ Devise comes with Omniauth support out of the box to authenticate with other providers. To use it, just specify your omniauth configuration in `config/initializers/devise.rb`:
374
+
375
+ ```ruby
376
+ config.omniauth :github, 'APP_ID', 'APP_SECRET', :scope => 'user,public_repo'
377
+ ```
378
+
379
+ You can read more about Omniauth support in the wiki:
343
380
 
344
381
  * https://github.com/plataformatec/devise/wiki/OmniAuth:-Overview
345
382
 
346
- ### Other ORMs
383
+ ### Configuring multiple models
347
384
 
348
- Devise supports ActiveRecord (default) and Mongoid. To choose other ORM, you just need to require it in the initializer file.
385
+ Devise allows you to set up as many roles as you want. For example, you may have a User model and also want an Admin model with just authentication and timeoutable features. If so, just follow these steps:
349
386
 
350
- ### Migrating from other solutions
387
+ ```ruby
388
+ # Create a migration with the required fields
389
+ create_table :admins do |t|
390
+ t.string :email
391
+ t.string :encrypted_password
392
+ t.timestamps
393
+ end
351
394
 
352
- Devise implements encryption strategies for Clearance, Authlogic and Restful-Authentication. To make use of these strategies, you need set the desired encryptor in the encryptor initializer config option and add :encryptable to your model. You might also need to rename your encrypted password and salt columns to match Devise's fields (encrypted_password and password_salt).
395
+ # Inside your Admin model
396
+ devise :database_authenticatable, :timeoutable
353
397
 
354
- ## Troubleshooting
398
+ # Inside your routes
399
+ devise_for :admins
400
+
401
+ # Inside your protected controller
402
+ before_filter :authenticate_admin!
403
+
404
+ # Inside your controllers and views
405
+ admin_signed_in?
406
+ current_admin
407
+ admin_session
408
+ ```
409
+
410
+ On the other hand, you can simply run the generator!
411
+
412
+ ### Other ORMs
413
+
414
+ Devise supports ActiveRecord (default) and Mongoid. To choose other ORM, you just need to require it in the initializer file.
415
+
416
+ ## Additional information
355
417
 
356
418
  ### Heroku
357
419
 
@@ -363,8 +425,6 @@ config.assets.initialize_on_precompile = false
363
425
 
364
426
  Read more about the potential issues at http://guides.rubyonrails.org/asset_pipeline.html
365
427
 
366
- ## Additional information
367
-
368
428
  ### Warden
369
429
 
370
430
  Devise is based on Warden, which is a general Rack authentication framework created by Daniel Neighman. We encourage you to read more about Warden here:
@@ -385,4 +445,6 @@ https://github.com/plataformatec/devise/contributors
385
445
 
386
446
  ## License
387
447
 
388
- MIT License. Copyright 2012 Plataformatec. http://plataformatec.com.br
448
+ MIT License. Copyright 2009-2013 Plataformatec. http://plataformatec.com.br
449
+
450
+ You are not granted rights or licenses to the trademarks of the Plataformatec, including without limitation the Devise name or logo.