devise 4.4.3 → 4.7.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (210) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +81 -2
  3. data/MIT-LICENSE +1 -1
  4. data/README.md +50 -21
  5. data/app/controllers/devise/passwords_controller.rb +1 -0
  6. data/app/controllers/devise/registrations_controller.rb +26 -8
  7. data/app/controllers/devise_controller.rb +1 -1
  8. data/app/helpers/devise_helper.rb +10 -19
  9. data/app/views/devise/confirmations/new.html.erb +1 -1
  10. data/app/views/devise/passwords/edit.html.erb +3 -3
  11. data/app/views/devise/passwords/new.html.erb +1 -1
  12. data/app/views/devise/registrations/edit.html.erb +4 -4
  13. data/app/views/devise/registrations/new.html.erb +3 -3
  14. data/app/views/devise/sessions/new.html.erb +3 -3
  15. data/app/views/devise/shared/_error_messages.html.erb +15 -0
  16. data/app/views/devise/shared/_links.html.erb +7 -7
  17. data/app/views/devise/unlocks/new.html.erb +1 -1
  18. data/config/locales/en.yml +2 -1
  19. data/lib/devise/controllers/helpers.rb +1 -1
  20. data/lib/devise/controllers/sign_in_out.rb +3 -0
  21. data/lib/devise/failure_app.rb +24 -3
  22. data/lib/devise/models/authenticatable.rb +38 -40
  23. data/lib/devise/models/confirmable.rb +16 -1
  24. data/lib/devise/models/database_authenticatable.rb +45 -11
  25. data/lib/devise/models/lockable.rb +2 -2
  26. data/lib/devise/models/registerable.rb +2 -0
  27. data/lib/devise/models/trackable.rb +8 -1
  28. data/lib/devise/models/validatable.rb +1 -1
  29. data/lib/devise/parameter_filter.rb +2 -0
  30. data/lib/devise/parameter_sanitizer.rb +13 -1
  31. data/lib/devise/rails/routes.rb +2 -2
  32. data/lib/devise/secret_key_finder.rb +2 -0
  33. data/lib/devise/strategies/authenticatable.rb +1 -1
  34. data/lib/devise/strategies/database_authenticatable.rb +6 -1
  35. data/lib/devise/test/controller_helpers.rb +1 -1
  36. data/lib/devise/version.rb +1 -1
  37. data/lib/devise.rb +4 -0
  38. data/lib/generators/active_record/devise_generator.rb +9 -9
  39. data/lib/generators/devise/controllers_generator.rb +1 -1
  40. data/lib/generators/devise/orm_helpers.rb +2 -2
  41. data/lib/generators/mongoid/devise_generator.rb +5 -5
  42. data/lib/generators/templates/devise.rb +19 -3
  43. data/lib/generators/templates/simple_form_for/confirmations/new.html.erb +5 -1
  44. data/lib/generators/templates/simple_form_for/passwords/edit.html.erb +10 -2
  45. data/lib/generators/templates/simple_form_for/passwords/new.html.erb +4 -1
  46. data/lib/generators/templates/simple_form_for/registrations/edit.html.erb +11 -3
  47. data/lib/generators/templates/simple_form_for/registrations/new.html.erb +11 -3
  48. data/lib/generators/templates/simple_form_for/sessions/new.html.erb +7 -2
  49. data/lib/generators/templates/simple_form_for/unlocks/new.html.erb +4 -1
  50. metadata +5 -310
  51. data/.gitignore +0 -10
  52. data/.travis.yml +0 -68
  53. data/.yardopts +0 -9
  54. data/CODE_OF_CONDUCT.md +0 -22
  55. data/CONTRIBUTING.md +0 -79
  56. data/Gemfile +0 -39
  57. data/Gemfile.lock +0 -193
  58. data/ISSUE_TEMPLATE.md +0 -19
  59. data/Rakefile +0 -37
  60. data/bin/test +0 -13
  61. data/devise.gemspec +0 -28
  62. data/devise.png +0 -0
  63. data/gemfiles/Gemfile.rails-4.1-stable +0 -32
  64. data/gemfiles/Gemfile.rails-4.1-stable.lock +0 -171
  65. data/gemfiles/Gemfile.rails-4.2-stable +0 -32
  66. data/gemfiles/Gemfile.rails-4.2-stable.lock +0 -192
  67. data/gemfiles/Gemfile.rails-5.0-stable +0 -33
  68. data/gemfiles/Gemfile.rails-5.0-stable.lock +0 -192
  69. data/gemfiles/Gemfile.rails-5.2-rc1 +0 -26
  70. data/gemfiles/Gemfile.rails-5.2-rc1.lock +0 -201
  71. data/guides/bug_report_templates/integration_test.rb +0 -106
  72. data/test/controllers/custom_registrations_controller_test.rb +0 -42
  73. data/test/controllers/custom_strategy_test.rb +0 -66
  74. data/test/controllers/helper_methods_test.rb +0 -24
  75. data/test/controllers/helpers_test.rb +0 -318
  76. data/test/controllers/inherited_controller_i18n_messages_test.rb +0 -53
  77. data/test/controllers/internal_helpers_test.rb +0 -129
  78. data/test/controllers/load_hooks_controller_test.rb +0 -21
  79. data/test/controllers/passwords_controller_test.rb +0 -34
  80. data/test/controllers/sessions_controller_test.rb +0 -108
  81. data/test/controllers/url_helpers_test.rb +0 -67
  82. data/test/delegator_test.rb +0 -21
  83. data/test/devise_test.rb +0 -109
  84. data/test/failure_app_test.rb +0 -340
  85. data/test/generators/active_record_generator_test.rb +0 -130
  86. data/test/generators/controllers_generator_test.rb +0 -50
  87. data/test/generators/devise_generator_test.rb +0 -41
  88. data/test/generators/install_generator_test.rb +0 -26
  89. data/test/generators/mongoid_generator_test.rb +0 -25
  90. data/test/generators/views_generator_test.rb +0 -105
  91. data/test/helpers/devise_helper_test.rb +0 -51
  92. data/test/integration/authenticatable_test.rb +0 -706
  93. data/test/integration/confirmable_test.rb +0 -326
  94. data/test/integration/database_authenticatable_test.rb +0 -97
  95. data/test/integration/http_authenticatable_test.rb +0 -114
  96. data/test/integration/lockable_test.rb +0 -242
  97. data/test/integration/mounted_engine_test.rb +0 -38
  98. data/test/integration/omniauthable_test.rb +0 -148
  99. data/test/integration/recoverable_test.rb +0 -349
  100. data/test/integration/registerable_test.rb +0 -365
  101. data/test/integration/rememberable_test.rb +0 -219
  102. data/test/integration/timeoutable_test.rb +0 -186
  103. data/test/integration/trackable_test.rb +0 -99
  104. data/test/mailers/confirmation_instructions_test.rb +0 -117
  105. data/test/mailers/email_changed_test.rb +0 -132
  106. data/test/mailers/mailer_test.rb +0 -20
  107. data/test/mailers/reset_password_instructions_test.rb +0 -98
  108. data/test/mailers/unlock_instructions_test.rb +0 -93
  109. data/test/mapping_test.rb +0 -136
  110. data/test/models/authenticatable_test.rb +0 -25
  111. data/test/models/confirmable_test.rb +0 -549
  112. data/test/models/database_authenticatable_test.rb +0 -283
  113. data/test/models/lockable_test.rb +0 -352
  114. data/test/models/omniauthable_test.rb +0 -9
  115. data/test/models/recoverable_test.rb +0 -263
  116. data/test/models/registerable_test.rb +0 -9
  117. data/test/models/rememberable_test.rb +0 -184
  118. data/test/models/serializable_test.rb +0 -60
  119. data/test/models/timeoutable_test.rb +0 -53
  120. data/test/models/trackable_test.rb +0 -62
  121. data/test/models/validatable_test.rb +0 -121
  122. data/test/models_test.rb +0 -155
  123. data/test/omniauth/config_test.rb +0 -61
  124. data/test/omniauth/url_helpers_test.rb +0 -53
  125. data/test/orm/active_record.rb +0 -24
  126. data/test/orm/mongoid.rb +0 -15
  127. data/test/parameter_sanitizer_test.rb +0 -77
  128. data/test/rails_app/Rakefile +0 -6
  129. data/test/rails_app/app/active_record/admin.rb +0 -8
  130. data/test/rails_app/app/active_record/shim.rb +0 -4
  131. data/test/rails_app/app/active_record/user.rb +0 -20
  132. data/test/rails_app/app/active_record/user_on_engine.rb +0 -9
  133. data/test/rails_app/app/active_record/user_on_main_app.rb +0 -9
  134. data/test/rails_app/app/active_record/user_with_validations.rb +0 -12
  135. data/test/rails_app/app/active_record/user_without_email.rb +0 -10
  136. data/test/rails_app/app/controllers/admins/sessions_controller.rb +0 -8
  137. data/test/rails_app/app/controllers/admins_controller.rb +0 -8
  138. data/test/rails_app/app/controllers/application_controller.rb +0 -13
  139. data/test/rails_app/app/controllers/application_with_fake_engine.rb +0 -32
  140. data/test/rails_app/app/controllers/custom/registrations_controller.rb +0 -33
  141. data/test/rails_app/app/controllers/home_controller.rb +0 -31
  142. data/test/rails_app/app/controllers/publisher/registrations_controller.rb +0 -4
  143. data/test/rails_app/app/controllers/publisher/sessions_controller.rb +0 -4
  144. data/test/rails_app/app/controllers/users/omniauth_callbacks_controller.rb +0 -16
  145. data/test/rails_app/app/controllers/users_controller.rb +0 -33
  146. data/test/rails_app/app/helpers/application_helper.rb +0 -5
  147. data/test/rails_app/app/mailers/users/from_proc_mailer.rb +0 -5
  148. data/test/rails_app/app/mailers/users/mailer.rb +0 -5
  149. data/test/rails_app/app/mailers/users/reply_to_mailer.rb +0 -6
  150. data/test/rails_app/app/mongoid/admin.rb +0 -31
  151. data/test/rails_app/app/mongoid/shim.rb +0 -25
  152. data/test/rails_app/app/mongoid/user.rb +0 -50
  153. data/test/rails_app/app/mongoid/user_on_engine.rb +0 -41
  154. data/test/rails_app/app/mongoid/user_on_main_app.rb +0 -41
  155. data/test/rails_app/app/mongoid/user_with_validations.rb +0 -37
  156. data/test/rails_app/app/mongoid/user_without_email.rb +0 -35
  157. data/test/rails_app/app/views/admins/index.html.erb +0 -1
  158. data/test/rails_app/app/views/admins/sessions/new.html.erb +0 -2
  159. data/test/rails_app/app/views/home/admin_dashboard.html.erb +0 -1
  160. data/test/rails_app/app/views/home/index.html.erb +0 -1
  161. data/test/rails_app/app/views/home/join.html.erb +0 -1
  162. data/test/rails_app/app/views/home/private.html.erb +0 -1
  163. data/test/rails_app/app/views/home/user_dashboard.html.erb +0 -1
  164. data/test/rails_app/app/views/layouts/application.html.erb +0 -24
  165. data/test/rails_app/app/views/users/edit_form.html.erb +0 -1
  166. data/test/rails_app/app/views/users/index.html.erb +0 -1
  167. data/test/rails_app/app/views/users/mailer/confirmation_instructions.erb +0 -1
  168. data/test/rails_app/app/views/users/sessions/new.html.erb +0 -1
  169. data/test/rails_app/bin/bundle +0 -3
  170. data/test/rails_app/bin/rails +0 -4
  171. data/test/rails_app/bin/rake +0 -4
  172. data/test/rails_app/config/application.rb +0 -48
  173. data/test/rails_app/config/boot.rb +0 -27
  174. data/test/rails_app/config/database.yml +0 -18
  175. data/test/rails_app/config/environment.rb +0 -7
  176. data/test/rails_app/config/environments/development.rb +0 -32
  177. data/test/rails_app/config/environments/production.rb +0 -88
  178. data/test/rails_app/config/environments/test.rb +0 -47
  179. data/test/rails_app/config/initializers/backtrace_silencers.rb +0 -9
  180. data/test/rails_app/config/initializers/devise.rb +0 -182
  181. data/test/rails_app/config/initializers/inflections.rb +0 -4
  182. data/test/rails_app/config/initializers/secret_token.rb +0 -5
  183. data/test/rails_app/config/initializers/session_store.rb +0 -3
  184. data/test/rails_app/config/routes.rb +0 -128
  185. data/test/rails_app/config.ru +0 -4
  186. data/test/rails_app/db/migrate/20100401102949_create_tables.rb +0 -77
  187. data/test/rails_app/db/schema.rb +0 -57
  188. data/test/rails_app/lib/shared_admin.rb +0 -23
  189. data/test/rails_app/lib/shared_user.rb +0 -32
  190. data/test/rails_app/lib/shared_user_without_email.rb +0 -28
  191. data/test/rails_app/lib/shared_user_without_omniauth.rb +0 -15
  192. data/test/rails_app/public/404.html +0 -26
  193. data/test/rails_app/public/422.html +0 -26
  194. data/test/rails_app/public/500.html +0 -26
  195. data/test/rails_app/public/favicon.ico +0 -0
  196. data/test/rails_test.rb +0 -11
  197. data/test/routes_test.rb +0 -281
  198. data/test/secret_key_finder_test.rb +0 -97
  199. data/test/support/action_controller/record_identifier.rb +0 -12
  200. data/test/support/assertions.rb +0 -30
  201. data/test/support/helpers.rb +0 -83
  202. data/test/support/http_method_compatibility.rb +0 -53
  203. data/test/support/integration.rb +0 -95
  204. data/test/support/locale/en.yml +0 -8
  205. data/test/support/mongoid.yml +0 -6
  206. data/test/support/webrat/integrations/rails.rb +0 -35
  207. data/test/test/controller_helpers_test.rb +0 -193
  208. data/test/test/integration_helpers_test.rb +0 -34
  209. data/test/test_helper.rb +0 -36
  210. data/test/test_models.rb +0 -35
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 554c50f7db4c13beb0b2eb9ee1dbdd863aef2e7647de61d7070adac0b60fd1c7
4
- data.tar.gz: 7624cffe7f3383660d08bca3c10b4f0c3ce2d5696b1f52cfe2e8b2b023c79fed
3
+ metadata.gz: 6dc5ab8b0dc2a902bcf6f66b156b87cdb5348a336f05fb8605b6db1d1f688bc5
4
+ data.tar.gz: 3be07eb3511c19857e9ddd2071b469833ac88d5c780c0a3c831c94523252663b
5
5
  SHA512:
6
- metadata.gz: fa0cacb024cecbfb7a031f0dd5b5e8cf2ea518ecbd89b3f2d3994614bf8d859548984b4675f4cd1be1f73b17c0a07214e9d62e08e4d7362450664b27083bc1a4
7
- data.tar.gz: e249d22cc464e7b04b53e990ff0c6e15b3c48a1bb7e8d9ef0a10722b867649840b7b5d48b30f234e9963400b773608b31c3732aeb5665287cea940d568bb5abe
6
+ metadata.gz: 599ee2531bd66335b49e7282d2af71be9e02594fc36733ec3c8f96110a256ee918e45a56c88640558b16e943a599881435cdd0dbaa2029636d830364cfbcfeb4
7
+ data.tar.gz: e785db9c81e1275f283896d604124067b67685bced32267a75f0205f39d98a0985d68d40933859e31196cd773ccf260841cf1663a4ee9dcaab9c397af2f1c1b2
data/CHANGELOG.md CHANGED
@@ -1,5 +1,84 @@
1
1
  ### Unreleased
2
2
 
3
+ ### 4.7.1 - 2019-09-06
4
+
5
+ * bug fixes
6
+ * Fix an edge case where records with a blank `confirmation_token` could be confirmed (by @tegon)
7
+ * Fix typo inside `update_needs_confirmation` i18n key (by @lslm)
8
+
9
+ ### 4.7.0 - 2019-08-19
10
+
11
+ * enhancements
12
+ * Support Rails 6.0
13
+ * Update CI to rails 6.0.0.beta3 (by @tunnes)
14
+ * refactor method name to be more consistent (by @saiqulhaq)
15
+ * Fix rails 6.0.rc1 email uniqueness validation deprecation warning (by @Vasfed)
16
+
17
+ * bug fixes
18
+ * Add `autocomplete="new-password"` to `password_confirmation` fields (by @ferrl)
19
+ * Fix rails_51_and_up? method for Rails 6.rc1 (by @igorkasyanchuk)
20
+
21
+ ### 4.6.2 - 2019-03-26
22
+
23
+ * bug fixes
24
+ * Revert "Set `encrypted_password` to `nil` when `password` is set to `nil`" since it broke backward compatibility with existing applications. See more on https://github.com/plataformatec/devise/issues/5033#issuecomment-476386275 (by @mracos)
25
+
26
+ ### 4.6.1 - 2019-02-11
27
+
28
+ * bug fixes
29
+ * Check if `root_path` is defined with `#respond_to?` instead of `#present` (by @tegon)
30
+
31
+ ### 4.6.0 - 2019-02-07
32
+
33
+ * enhancements
34
+ * Allow to skip email and password change notifications (by @iorme1)
35
+ * Include the use of `nil` for `allow_unconfirmed_access_for` in the docs (by @joaumg)
36
+ * Ignore useless files into the `.gem` file (by @huacnlee)
37
+ * Explain the code that prevents enumeration attacks inside `Devise::Strategies::DatabaseAuthenticatable` (by @tegon)
38
+ * Refactor the `devise_error_messages!` helper to render a partial (by @prograhamer)
39
+ * Add an option (`Devise.sign_in_after_change_password`) to not automatically sign in a user after changing a password (by @knjko)
40
+
41
+ * bug fixes
42
+ * Fix missing comma in Simple Form generator (by @colinross)
43
+ * Fix error with migration generator in Rails 6 (by @oystersauce8)
44
+ * Set `encrypted_password` to `nil` when `password` is set to `nil` (by @sivagollapalli)
45
+ * Consider whether the request supports flash messages inside `Devise::Controllers::Helpers#is_flashing_format?` (by @colinross)
46
+ * Fix typo inside `Devise::Generators::ControllersGenerator` (by @kopylovvlad)
47
+ * Sanitize parameters inside `Devise::Models::Authenticatable#find_or_initialize_with_errors` (by @rlue)
48
+ * `#after_database_authentication` callback was not called after authentication on password reset (by @kanmaniselvan)
49
+ * Fix corner case when `#confirmation_period_valid?` was called at the same second as `confirmation_sent_at` was set. Mostly true for date types that only have second precisions. (by @stanhu)
50
+ * Fix unclosed `li` tag in `error_messages` partial (by @mracos)
51
+ * Fix Routes issue when devise engine is mounted in another engine on Rails versions lower than 5.1 (by @a-barbieri)
52
+ * Make `#increment_failed_attempts` concurrency safe (by @tegon)
53
+ * Apply Test Helper fix to Rails 6.0 as well as 5.x (by @matthewrudy)
54
+
55
+
56
+ * deprecations
57
+ * The second argument of `DatabaseAuthenticatable`'s `#update_with_password` and `#update_without_password` is deprecated and will be removed in the next major version. It was added to support a feature deprecated in Rails 4, so you can safely remove it from your code. (by @ihatov08)
58
+ * The `DeviseHelper.devise_error_messages!` is deprecated and will be removed in the next major version. Use the `devise/shared/error_messages` partial instead. (by @mracos)
59
+
60
+ ### 4.5.0 - 2018-08-15
61
+
62
+ * enhancements
63
+ * Use `before_action` instead of `before_filter` (by @edenthecat)
64
+ * Allow people to extend devise failure app, through invoking `ActiveSupport.run_load_hooks` once `Devise::FailureApp` is loaded (by @wnm)
65
+ * Use `update` instead of `update_attributes` (by @koic)
66
+ * Split IP resolution from `update_tracked_fields` (by @mckramer)
67
+ * upgrade dependencies for rails and responders (by @lancecarlson)
68
+ * Add `autocomplete="new-password"` to new password fields (by @gssbzn)
69
+ * Add `autocomplete="current-password"` to current password fields (by @gssbzn)
70
+ * Remove redundant `self` from `database_authenticatable` module (by @abhishekkanojia)
71
+ * Update `simple_form` templates with changes from https://github.com/plataformatec/devise/commit/16b3d6d67c7e017d461ea17ed29ea9738dc77e83 and https://github.com/plataformatec/devise/commit/6260c29a867b9a656f1e1557abe347a523178fab (by @gssbzn)
72
+ * Remove `:trackable` from the default modules in the generators, to be more GDPR-friendly (by @fakenine)
73
+
74
+ * bug fixes
75
+ * Use same string on failed login regardless of whether account exists when in paranoid mode (by @TonyMK9068)
76
+ * Fix error when params is not a hash inside `Devise::ParameterSanitizer` (by @b0nn1e)
77
+ * Look for `secret_key_base` inside `Rails.application` (by @gencer)
78
+ * Ensure `Devise::ParameterFilter` does not add missing keys when called with a hash that has a `default` / `default_proc`
79
+ configured (by @joshpencheon)
80
+ * Adds `is_navigational_format?` check to `after_sign_up_path_for` to keep consistency (by @iorme1)
81
+
3
82
  ### 4.4.3 - 2018-03-17
4
83
 
5
84
  * bug fixes
@@ -44,7 +123,7 @@
44
123
  * Validations were being ignored on singup in the `Trackable#update_tracked_fields!` method. (by @AshleyFoster)
45
124
  * Do not modify options for `#serializable_hash`. (by @guigs)
46
125
  * Email confirmations were being sent on sign in/sign out for application using `mongoid` and `mongoid-paperclip` gems. This is because previously we were checking if a model is from Active Record by checking if the method `after_commit` was defined - since `mongoid` doesn' have one - but `mongoid-paperclip` gem does define one, which cause this issue. (by @fjg)
47
-
126
+
48
127
  ### 4.3.0 - 2017-05-14
49
128
 
50
129
  * Enhancements
@@ -233,7 +312,7 @@
233
312
  end
234
313
  ```
235
314
 
236
- You can check more examples and explanations on the [README section](/plataformatec/devise#strong-parameters)
315
+ You can check more examples and explanations on the [README section](README.md#strong-parameters)
237
316
  and on the [ParameterSanitizer docs](lib/devise/parameter_sanitizer.rb).
238
317
 
239
318
  Please check [3-stable](https://github.com/plataformatec/devise/blob/3-stable/CHANGELOG.md)
data/MIT-LICENSE CHANGED
@@ -1,4 +1,4 @@
1
- Copyright 2009-2017 Plataformatec. http://plataformatec.com.br
1
+ Copyright 2009-2019 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
@@ -16,16 +16,16 @@ Devise is a flexible authentication solution for Rails based on Warden. It:
16
16
 
17
17
  It's composed of 10 modules:
18
18
 
19
- * [Database Authenticatable](http://rubydoc.info/github/plataformatec/devise/master/Devise/Models/DatabaseAuthenticatable): hashes 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.
20
- * [Omniauthable](http://rubydoc.info/github/plataformatec/devise/master/Devise/Models/Omniauthable): adds OmniAuth (https://github.com/omniauth/omniauth) support.
21
- * [Confirmable](http://rubydoc.info/github/plataformatec/devise/master/Devise/Models/Confirmable): sends emails with confirmation instructions and verifies whether an account is already confirmed during sign in.
22
- * [Recoverable](http://rubydoc.info/github/plataformatec/devise/master/Devise/Models/Recoverable): resets the user password and sends reset instructions.
23
- * [Registerable](http://rubydoc.info/github/plataformatec/devise/master/Devise/Models/Registerable): handles signing up users through a registration process, also allowing them to edit and destroy their account.
24
- * [Rememberable](http://rubydoc.info/github/plataformatec/devise/master/Devise/Models/Rememberable): manages generating and clearing a token for remembering the user from a saved cookie.
25
- * [Trackable](http://rubydoc.info/github/plataformatec/devise/master/Devise/Models/Trackable): tracks sign in count, timestamps and IP address.
26
- * [Timeoutable](http://rubydoc.info/github/plataformatec/devise/master/Devise/Models/Timeoutable): expires sessions that have not been active in a specified period of time.
27
- * [Validatable](http://rubydoc.info/github/plataformatec/devise/master/Devise/Models/Validatable): provides validations of email and password. It's optional and can be customized, so you're able to define your own validations.
28
- * [Lockable](http://rubydoc.info/github/plataformatec/devise/master/Devise/Models/Lockable): locks an account after a specified number of failed sign-in attempts. Can unlock via email or after a specified time period.
19
+ * [Database Authenticatable](http://www.rubydoc.info/github/plataformatec/devise/master/Devise/Models/DatabaseAuthenticatable): hashes 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.
20
+ * [Omniauthable](http://www.rubydoc.info/github/plataformatec/devise/master/Devise/Models/Omniauthable): adds OmniAuth (https://github.com/omniauth/omniauth) support.
21
+ * [Confirmable](http://www.rubydoc.info/github/plataformatec/devise/master/Devise/Models/Confirmable): sends emails with confirmation instructions and verifies whether an account is already confirmed during sign in.
22
+ * [Recoverable](http://www.rubydoc.info/github/plataformatec/devise/master/Devise/Models/Recoverable): resets the user password and sends reset instructions.
23
+ * [Registerable](http://www.rubydoc.info/github/plataformatec/devise/master/Devise/Models/Registerable): handles signing up users through a registration process, also allowing them to edit and destroy their account.
24
+ * [Rememberable](http://www.rubydoc.info/github/plataformatec/devise/master/Devise/Models/Rememberable): manages generating and clearing a token for remembering the user from a saved cookie.
25
+ * [Trackable](http://www.rubydoc.info/github/plataformatec/devise/master/Devise/Models/Trackable): tracks sign in count, timestamps and IP address.
26
+ * [Timeoutable](http://www.rubydoc.info/github/plataformatec/devise/master/Devise/Models/Timeoutable): expires sessions that have not been active in a specified period of time.
27
+ * [Validatable](http://www.rubydoc.info/github/plataformatec/devise/master/Devise/Models/Validatable): provides validations of email and password. It's optional and can be customized, so you're able to define your own validations.
28
+ * [Lockable](http://www.rubydoc.info/github/plataformatec/devise/master/Devise/Models/Lockable): locks an account after a specified number of failed sign-in attempts. Can unlock via email or after a specified time period.
29
29
 
30
30
  ## Table of Contents
31
31
 
@@ -53,14 +53,10 @@ It's composed of 10 modules:
53
53
  - [Integration tests](#integration-tests)
54
54
  - [OmniAuth](#omniauth)
55
55
  - [Configuring multiple models](#configuring-multiple-models)
56
- - [Create a migration with the required fields](#create-a-migration-with-the-required-fields)
57
- - [Inside your Admin model](#inside-your-admin-model)
58
- - [Inside your routes](#inside-your-routes)
59
- - [Inside your protected controller](#inside-your-protected-controller)
60
- - [Inside your controllers and views](#inside-your-controllers-and-views)
61
56
  - [ActiveJob Integration](#activejob-integration)
62
57
  - [Password reset tokens and Rails logs](#password-reset-tokens-and-rails-logs)
63
58
  - [Other ORMs](#other-orms)
59
+ - [Rails API mode](#rails-api-mode)
64
60
  - [Additional information](#additional-information)
65
61
  - [Heroku](#heroku)
66
62
  - [Warden](#warden)
@@ -140,7 +136,7 @@ Please note that the command output will show the variable value being used.
140
136
 
141
137
  ### BUNDLE_GEMFILE
142
138
  We can use this variable to tell bundler what Gemfile it should use (instead of the one in the current directory).
143
- Inside the [gemfiles](https://github.com/plataformatec/devise/tree/master/gemfiles) directory, we have one for each version of Rails we support. When you send us a pull request, it may happen that the test suite brakes on Travis using some of them. If that's the case, you can simulate the same environment using the `BUNDLE_GEMFILE` variable.
139
+ Inside the [gemfiles](https://github.com/plataformatec/devise/tree/master/gemfiles) directory, we have one for each version of Rails we support. When you send us a pull request, it may happen that the test suite breaks on Travis using some of them. If that's the case, you can simulate the same environment using the `BUNDLE_GEMFILE` variable.
144
140
  For example, if the tests broke using Ruby 2.4.2 and Rails 4.1, you can do the following:
145
141
  ```bash
146
142
  rbenv shell 2.4.2 # or rvm use 2.4.2
@@ -154,19 +150,37 @@ BUNDLE_GEMFILE=gemfiles/Gemfile.rails-4.1-stable bundle install
154
150
  BUNDLE_GEMFILE=gemfiles/Gemfile.rails-4.1-stable DEVISE_ORM=mongoid bin/test
155
151
  ```
156
152
 
153
+ ### Running tests
154
+ Devise uses [Mini Test](https://github.com/seattlerb/minitest) as test framework.
155
+
156
+ * Running all tests:
157
+ ```bash
158
+ bin/test
159
+ ```
160
+
161
+ * Running tests for an specific file:
162
+ ```bash
163
+ bin/test test/models/trackable_test.rb
164
+ ```
165
+
166
+ * Running a specific test given a regex:
167
+ ```bash
168
+ bin/test test/models/trackable_test.rb:16
169
+ ```
170
+
157
171
  ## Starting with Rails?
158
172
 
159
173
  If you are building your first Rails application, we recommend you *do not* use Devise. Devise requires a good understanding of the Rails Framework. In such cases, we advise you to start a simple authentication system from scratch. Today, we have three resources that should help you get started:
160
174
 
161
175
  * Michael Hartl's online book: https://www.railstutorial.org/book/modeling_users
162
176
  * Ryan Bates' Railscast: http://railscasts.com/episodes/250-authentication-from-scratch
163
- * Codecademy's Ruby on Rails: Authentication and Authorization: http://www.codecademy.com/en/learn/rails-auth
177
+ * Codecademy's Ruby on Rails: Authentication and Authorization: https://www.codecademy.com/learn/rails-auth
164
178
 
165
179
  Once you have solidified your understanding of Rails and authentication mechanisms, we assure you Devise will be very pleasant to work with. :smiley:
166
180
 
167
181
  ## Getting started
168
182
 
169
- Devise 4.0 works with Rails 4.1 onwards. You can add it to your Gemfile with:
183
+ Devise 4.0 works with Rails 4.1 onwards. Add the following line to your Gemfile:
170
184
 
171
185
  ```ruby
172
186
  gem 'devise'
@@ -195,7 +209,7 @@ In the following command you will replace `MODEL` with the class name used for t
195
209
  $ rails generate devise MODEL
196
210
  ```
197
211
 
198
- Next, check the MODEL for any additional configuration options you might want to add, such as confirmable or lockable. If you add an option, be sure to inspect the migration file (created by the generator if your ORM supports them) and uncomment the appropriate section. For example, if you add the confirmable option in the model, you'll need to uncomment the Confirmable section in the migration.
212
+ Next, check the MODEL for any additional configuration options you might want to add, such as confirmable or lockable. If you add an option, be sure to inspect the migration file (created by the generator if your ORM supports them) and uncomment the appropriate section. For example, if you add the confirmable option in the model, you'll need to uncomment the Confirmable section in the migration.
199
213
 
200
214
  Then run `rails db:migrate`
201
215
 
@@ -404,6 +418,7 @@ If the customization at the views level is not enough, you can customize each co
404
418
  ...
405
419
  end
406
420
  ```
421
+ (Use the -c flag to specify a controller, for example: `rails generate devise:controllers users -c=sessions`)
407
422
 
408
423
  2. Tell the router to use this controller:
409
424
 
@@ -519,6 +534,9 @@ cases/specs.
519
534
 
520
535
  Controller tests require that you include `Devise::Test::ControllerHelpers` on
521
536
  your test case or its parent `ActionController::TestCase` superclass.
537
+ For Rails 5, include `Devise::Test::IntegrationHelpers` instead, since the superclass
538
+ for controller tests has been changed to ActionDispatch::IntegrationTest
539
+ (for more details, see the [Integration tests](#integration-tests) section).
522
540
 
523
541
  ```ruby
524
542
  class PostsControllerTest < ActionController::TestCase
@@ -602,7 +620,7 @@ are executed in your tests.
602
620
 
603
621
  You can read more about testing your Rails 3 - Rails 4 controllers with RSpec in the wiki:
604
622
 
605
- * https://github.com/plataformatec/devise/wiki/How-To:-Test-controllers-with-Rails-3-and-4-%28and-RSpec%29
623
+ * https://github.com/plataformatec/devise/wiki/How-To:-Test-controllers-with-Rails-(and-RSpec)
606
624
 
607
625
  ### OmniAuth
608
626
 
@@ -677,6 +695,17 @@ config.log_level = :warn
677
695
 
678
696
  Devise supports ActiveRecord (default) and Mongoid. To select another ORM, simply require it in the initializer file.
679
697
 
698
+ ### Rails API Mode
699
+
700
+ Rails 5+ has a built-in [API Mode](https://edgeguides.rubyonrails.org/api_app.html) which optimizes Rails for use as an API (only). One of the side effects is that it changes the order of the middleware stack, and this can cause problems for `Devise::Test::IntegrationHelpers`. This problem usually surfaces as an ```undefined method `[]=' for nil:NilClass``` error when using integration test helpers, such as `#sign_in`. The solution is simply to reorder the middlewares by adding the following to test.rb:
701
+
702
+ ```ruby
703
+ Rails.application.config.middleware.insert_before Warden::Manager, ActionDispatch::Cookies
704
+ Rails.application.config.middleware.insert_before Warden::Manager, ActionDispatch::Session::CookieStore
705
+ ```
706
+
707
+ For a deeper understanding of this, review [this issue](https://github.com/plataformatec/devise/issues/4696).
708
+
680
709
  ## Additional information
681
710
 
682
711
  ### Heroku
@@ -703,6 +732,6 @@ https://github.com/plataformatec/devise/graphs/contributors
703
732
 
704
733
  ## License
705
734
 
706
- MIT License. Copyright 2009-2018 Plataformatec. http://plataformatec.com.br
735
+ MIT License. Copyright 2009-2019 Plataformatec. http://plataformatec.com.br
707
736
 
708
737
  You are not granted rights or licenses to the trademarks of Plataformatec, including without limitation the Devise name or logo.
@@ -39,6 +39,7 @@ class Devise::PasswordsController < DeviseController
39
39
  if Devise.sign_in_after_reset_password
40
40
  flash_message = resource.active_for_authentication? ? :updated : :updated_not_active
41
41
  set_flash_message!(:notice, flash_message)
42
+ resource.after_database_authentication
42
43
  sign_in(resource_name, resource)
43
44
  else
44
45
  set_flash_message!(:notice, :updated_not_active)
@@ -50,12 +50,9 @@ class Devise::RegistrationsController < DeviseController
50
50
  resource_updated = update_resource(resource, account_update_params)
51
51
  yield resource if block_given?
52
52
  if resource_updated
53
- if is_flashing_format?
54
- flash_key = update_needs_confirmation?(resource, prev_unconfirmed_email) ?
55
- :update_needs_confirmation : :updated
56
- set_flash_message :notice, flash_key
57
- end
58
- bypass_sign_in resource, scope: resource_name
53
+ set_flash_message_for_update(resource, prev_unconfirmed_email)
54
+ bypass_sign_in resource, scope: resource_name if sign_in_after_change_password?
55
+
59
56
  respond_with resource, location: after_update_path_for(resource)
60
57
  else
61
58
  clean_up_passwords resource
@@ -112,7 +109,7 @@ class Devise::RegistrationsController < DeviseController
112
109
  # The path used after sign up. You need to overwrite this method
113
110
  # in your own RegistrationsController.
114
111
  def after_sign_up_path_for(resource)
115
- after_sign_in_path_for(resource)
112
+ after_sign_in_path_for(resource) if is_navigational_format?
116
113
  end
117
114
 
118
115
  # The path used after sign up for inactive accounts. You need to overwrite
@@ -127,7 +124,7 @@ class Devise::RegistrationsController < DeviseController
127
124
  # The default url to be used after updating a resource. You need to overwrite
128
125
  # this method in your own RegistrationsController.
129
126
  def after_update_path_for(resource)
130
- signed_in_root_path(resource)
127
+ sign_in_after_change_password? ? signed_in_root_path(resource) : new_session_path(resource_name)
131
128
  end
132
129
 
133
130
  # Authenticates the current scope and gets the current resource from the session.
@@ -147,4 +144,25 @@ class Devise::RegistrationsController < DeviseController
147
144
  def translation_scope
148
145
  'devise.registrations'
149
146
  end
147
+
148
+ private
149
+
150
+ def set_flash_message_for_update(resource, prev_unconfirmed_email)
151
+ return unless is_flashing_format?
152
+
153
+ flash_key = if update_needs_confirmation?(resource, prev_unconfirmed_email)
154
+ :update_needs_confirmation
155
+ elsif sign_in_after_change_password?
156
+ :updated
157
+ else
158
+ :updated_but_not_signed_in
159
+ end
160
+ set_flash_message :notice, flash_key
161
+ end
162
+
163
+ def sign_in_after_change_password?
164
+ return true if account_update_params[:password].blank?
165
+
166
+ Devise.sign_in_after_change_password
167
+ end
150
168
  end
@@ -22,7 +22,7 @@ class DeviseController < Devise.parent_controller.constantize
22
22
  # Action Controller tests that forces _prefixes to be
23
23
  # loaded before even having a request object.
24
24
  #
25
- # This method should be public as it is is in ActionPack
25
+ # This method should be public as it is in ActionPack
26
26
  # itself. Changing its visibility may break other gems.
27
27
  def _prefixes #:nodoc:
28
28
  @_prefixes ||= if self.class.scoped_views? && request && devise_mapping
@@ -1,27 +1,18 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module DeviseHelper
4
- # A simple way to show error messages for the current devise resource. If you need
5
- # to customize this method, you can either overwrite it in your application helpers or
6
- # copy the views to your application.
7
- #
8
- # This method is intended to stay simple and it is unlikely that we are going to change
9
- # it to add more behavior or options.
4
+ # Retain this method for backwards compatibility, deprecated in favour of modifying the
5
+ # devise/shared/error_messages partial
10
6
  def devise_error_messages!
11
- return "" if resource.errors.empty?
12
-
13
- messages = resource.errors.full_messages.map { |msg| content_tag(:li, msg) }.join
14
- sentence = I18n.t("errors.messages.not_saved",
15
- count: resource.errors.count,
16
- resource: resource.class.model_name.human.downcase)
7
+ ActiveSupport::Deprecation.warn <<-DEPRECATION.strip_heredoc
8
+ [Devise] `DeviseHelper.devise_error_messages!`
9
+ is deprecated and it will be removed in the next major version.
10
+ To customize the errors styles please run `rails g devise:views` and modify the
11
+ `devise/shared/error_messages` partial.
12
+ DEPRECATION
17
13
 
18
- html = <<-HTML
19
- <div id="error_explanation">
20
- <h2>#{sentence}</h2>
21
- <ul>#{messages}</ul>
22
- </div>
23
- HTML
14
+ return "" if resource.errors.empty?
24
15
 
25
- html.html_safe
16
+ render "devise/shared/error_messages", resource: resource
26
17
  end
27
18
  end
@@ -1,7 +1,7 @@
1
1
  <h2>Resend confirmation instructions</h2>
2
2
 
3
3
  <%= form_for(resource, as: resource_name, url: confirmation_path(resource_name), html: { method: :post }) do |f| %>
4
- <%= devise_error_messages! %>
4
+ <%= render "devise/shared/error_messages", resource: resource %>
5
5
 
6
6
  <div class="field">
7
7
  <%= f.label :email %><br />
@@ -1,7 +1,7 @@
1
1
  <h2>Change your password</h2>
2
2
 
3
3
  <%= form_for(resource, as: resource_name, url: password_path(resource_name), html: { method: :put }) do |f| %>
4
- <%= devise_error_messages! %>
4
+ <%= render "devise/shared/error_messages", resource: resource %>
5
5
  <%= f.hidden_field :reset_password_token %>
6
6
 
7
7
  <div class="field">
@@ -9,12 +9,12 @@
9
9
  <% if @minimum_password_length %>
10
10
  <em>(<%= @minimum_password_length %> characters minimum)</em><br />
11
11
  <% end %>
12
- <%= f.password_field :password, autofocus: true, autocomplete: "off" %>
12
+ <%= f.password_field :password, autofocus: true, autocomplete: "new-password" %>
13
13
  </div>
14
14
 
15
15
  <div class="field">
16
16
  <%= f.label :password_confirmation, "Confirm new password" %><br />
17
- <%= f.password_field :password_confirmation, autocomplete: "off" %>
17
+ <%= f.password_field :password_confirmation, autocomplete: "new-password" %>
18
18
  </div>
19
19
 
20
20
  <div class="actions">
@@ -1,7 +1,7 @@
1
1
  <h2>Forgot your password?</h2>
2
2
 
3
3
  <%= form_for(resource, as: resource_name, url: password_path(resource_name), html: { method: :post }) do |f| %>
4
- <%= devise_error_messages! %>
4
+ <%= render "devise/shared/error_messages", resource: resource %>
5
5
 
6
6
  <div class="field">
7
7
  <%= f.label :email %><br />
@@ -1,7 +1,7 @@
1
1
  <h2>Edit <%= resource_name.to_s.humanize %></h2>
2
2
 
3
3
  <%= form_for(resource, as: resource_name, url: registration_path(resource_name), html: { method: :put }) do |f| %>
4
- <%= devise_error_messages! %>
4
+ <%= render "devise/shared/error_messages", resource: resource %>
5
5
 
6
6
  <div class="field">
7
7
  <%= f.label :email %><br />
@@ -14,7 +14,7 @@
14
14
 
15
15
  <div class="field">
16
16
  <%= f.label :password %> <i>(leave blank if you don't want to change it)</i><br />
17
- <%= f.password_field :password, autocomplete: "off" %>
17
+ <%= f.password_field :password, autocomplete: "new-password" %>
18
18
  <% if @minimum_password_length %>
19
19
  <br />
20
20
  <em><%= @minimum_password_length %> characters minimum</em>
@@ -23,12 +23,12 @@
23
23
 
24
24
  <div class="field">
25
25
  <%= f.label :password_confirmation %><br />
26
- <%= f.password_field :password_confirmation, autocomplete: "off" %>
26
+ <%= f.password_field :password_confirmation, autocomplete: "new-password" %>
27
27
  </div>
28
28
 
29
29
  <div class="field">
30
30
  <%= f.label :current_password %> <i>(we need your current password to confirm your changes)</i><br />
31
- <%= f.password_field :current_password, autocomplete: "off" %>
31
+ <%= f.password_field :current_password, autocomplete: "current-password" %>
32
32
  </div>
33
33
 
34
34
  <div class="actions">
@@ -1,7 +1,7 @@
1
1
  <h2>Sign up</h2>
2
2
 
3
3
  <%= form_for(resource, as: resource_name, url: registration_path(resource_name)) do |f| %>
4
- <%= devise_error_messages! %>
4
+ <%= render "devise/shared/error_messages", resource: resource %>
5
5
 
6
6
  <div class="field">
7
7
  <%= f.label :email %><br />
@@ -13,12 +13,12 @@
13
13
  <% if @minimum_password_length %>
14
14
  <em>(<%= @minimum_password_length %> characters minimum)</em>
15
15
  <% end %><br />
16
- <%= f.password_field :password, autocomplete: "off" %>
16
+ <%= f.password_field :password, autocomplete: "new-password" %>
17
17
  </div>
18
18
 
19
19
  <div class="field">
20
20
  <%= f.label :password_confirmation %><br />
21
- <%= f.password_field :password_confirmation, autocomplete: "off" %>
21
+ <%= f.password_field :password_confirmation, autocomplete: "new-password" %>
22
22
  </div>
23
23
 
24
24
  <div class="actions">
@@ -8,15 +8,15 @@
8
8
 
9
9
  <div class="field">
10
10
  <%= f.label :password %><br />
11
- <%= f.password_field :password, autocomplete: "off" %>
11
+ <%= f.password_field :password, autocomplete: "current-password" %>
12
12
  </div>
13
13
 
14
- <% if devise_mapping.rememberable? -%>
14
+ <% if devise_mapping.rememberable? %>
15
15
  <div class="field">
16
16
  <%= f.check_box :remember_me %>
17
17
  <%= f.label :remember_me %>
18
18
  </div>
19
- <% end -%>
19
+ <% end %>
20
20
 
21
21
  <div class="actions">
22
22
  <%= f.submit "Log in" %>
@@ -0,0 +1,15 @@
1
+ <% if resource.errors.any? %>
2
+ <div id="error_explanation">
3
+ <h2>
4
+ <%= I18n.t("errors.messages.not_saved",
5
+ count: resource.errors.count,
6
+ resource: resource.class.model_name.human.downcase)
7
+ %>
8
+ </h2>
9
+ <ul>
10
+ <% resource.errors.full_messages.each do |message| %>
11
+ <li><%= message %></li>
12
+ <% end %>
13
+ </ul>
14
+ </div>
15
+ <% end %>
@@ -1,25 +1,25 @@
1
1
  <%- if controller_name != 'sessions' %>
2
2
  <%= link_to "Log in", new_session_path(resource_name) %><br />
3
- <% end -%>
3
+ <% end %>
4
4
 
5
5
  <%- if devise_mapping.registerable? && controller_name != 'registrations' %>
6
6
  <%= link_to "Sign up", new_registration_path(resource_name) %><br />
7
- <% end -%>
7
+ <% end %>
8
8
 
9
9
  <%- if devise_mapping.recoverable? && controller_name != 'passwords' && controller_name != 'registrations' %>
10
10
  <%= link_to "Forgot your password?", new_password_path(resource_name) %><br />
11
- <% end -%>
11
+ <% end %>
12
12
 
13
13
  <%- if devise_mapping.confirmable? && controller_name != 'confirmations' %>
14
14
  <%= link_to "Didn't receive confirmation instructions?", new_confirmation_path(resource_name) %><br />
15
- <% end -%>
15
+ <% end %>
16
16
 
17
17
  <%- if devise_mapping.lockable? && resource_class.unlock_strategy_enabled?(:email) && controller_name != 'unlocks' %>
18
18
  <%= link_to "Didn't receive unlock instructions?", new_unlock_path(resource_name) %><br />
19
- <% end -%>
19
+ <% end %>
20
20
 
21
21
  <%- if devise_mapping.omniauthable? %>
22
22
  <%- resource_class.omniauth_providers.each do |provider| %>
23
23
  <%= link_to "Sign in with #{OmniAuth::Utils.camelize(provider)}", omniauth_authorize_path(resource_name, provider) %><br />
24
- <% end -%>
25
- <% end -%>
24
+ <% end %>
25
+ <% end %>
@@ -1,7 +1,7 @@
1
1
  <h2>Resend unlock instructions</h2>
2
2
 
3
3
  <%= form_for(resource, as: resource_name, url: unlock_path(resource_name), html: { method: :post }) do |f| %>
4
- <%= devise_error_messages! %>
4
+ <%= render "devise/shared/error_messages", resource: resource %>
5
5
 
6
6
  <div class="field">
7
7
  <%= f.label :email %><br />
@@ -42,8 +42,9 @@ en:
42
42
  signed_up_but_inactive: "You have signed up successfully. However, we could not sign you in because your account is not yet activated."
43
43
  signed_up_but_locked: "You have signed up successfully. However, we could not sign you in because your account is locked."
44
44
  signed_up_but_unconfirmed: "A message with a confirmation link has been sent to your email address. Please follow the link to activate your account."
45
- update_needs_confirmation: "You updated your account successfully, but we need to verify your new email address. Please check your email and follow the confirm link to confirm your new email address."
45
+ update_needs_confirmation: "You updated your account successfully, but we need to verify your new email address. Please check your email and follow the confirmation link to confirm your new email address."
46
46
  updated: "Your account has been updated successfully."
47
+ updated_but_not_signed_in: "Your account has been updated successfully, but since your password was changed, you need to sign in again"
47
48
  sessions:
48
49
  signed_in: "Signed in successfully."
49
50
  signed_out: "Signed out successfully."
@@ -268,7 +268,7 @@ module Devise
268
268
  # Check if flash messages should be emitted. Default is to do it on
269
269
  # navigational formats
270
270
  def is_flashing_format?
271
- is_navigational_format?
271
+ request.respond_to?(:flash) && is_navigational_format?
272
272
  end
273
273
 
274
274
  private
@@ -19,6 +19,9 @@ module Devise
19
19
  # Sign in a user that already was authenticated. This helper is useful for logging
20
20
  # users in after sign up. All options given to sign_in is passed forward
21
21
  # to the set_user method in warden.
22
+ # If you are using a custom warden strategy and the timeoutable module, you have to
23
+ # set `env["devise.skip_timeout"] = true` in the request to use this method, like we do
24
+ # in the sessions controller: https://github.com/plataformatec/devise/blob/master/app/controllers/devise/sessions_controller.rb#L7
22
25
  #
23
26
  # Examples:
24
27
  #