devise 4.3.0 → 4.4.0

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of devise might be problematic. Click here for more details.

Files changed (215) hide show
  1. checksums.yaml +4 -4
  2. data/.travis.yml +10 -5
  3. data/CHANGELOG.md +20 -0
  4. data/Gemfile +2 -3
  5. data/Gemfile.lock +2 -3
  6. data/ISSUE_TEMPLATE.md +19 -0
  7. data/README.md +66 -2
  8. data/Rakefile +1 -0
  9. data/app/controllers/devise/confirmations_controller.rb +2 -0
  10. data/app/controllers/devise/omniauth_callbacks_controller.rb +3 -1
  11. data/app/controllers/devise/passwords_controller.rb +2 -0
  12. data/app/controllers/devise/registrations_controller.rb +5 -3
  13. data/app/controllers/devise/sessions_controller.rb +3 -1
  14. data/app/controllers/devise/unlocks_controller.rb +2 -0
  15. data/app/controllers/devise_controller.rb +2 -0
  16. data/app/helpers/devise_helper.rb +2 -0
  17. data/app/mailers/devise/mailer.rb +2 -0
  18. data/app/views/devise/confirmations/new.html.erb +1 -1
  19. data/app/views/devise/passwords/new.html.erb +1 -1
  20. data/app/views/devise/registrations/edit.html.erb +1 -1
  21. data/app/views/devise/registrations/new.html.erb +1 -1
  22. data/app/views/devise/sessions/new.html.erb +1 -1
  23. data/app/views/devise/unlocks/new.html.erb +1 -1
  24. data/devise.gemspec +2 -0
  25. data/gemfiles/Gemfile.rails-4.1-stable +3 -1
  26. data/gemfiles/Gemfile.rails-4.1-stable.lock +3 -3
  27. data/gemfiles/Gemfile.rails-4.2-stable +3 -1
  28. data/gemfiles/Gemfile.rails-4.2-stable.lock +3 -3
  29. data/gemfiles/Gemfile.rails-5.0-stable +2 -3
  30. data/gemfiles/Gemfile.rails-5.0-stable.lock +2 -3
  31. data/guides/bug_report_templates/integration_test.rb +2 -0
  32. data/lib/devise.rb +3 -1
  33. data/lib/devise/controllers/helpers.rb +7 -5
  34. data/lib/devise/controllers/rememberable.rb +2 -0
  35. data/lib/devise/controllers/scoped_views.rb +2 -0
  36. data/lib/devise/controllers/sign_in_out.rb +2 -0
  37. data/lib/devise/controllers/store_location.rb +24 -6
  38. data/lib/devise/controllers/url_helpers.rb +2 -0
  39. data/lib/devise/delegator.rb +2 -0
  40. data/lib/devise/encryptor.rb +2 -0
  41. data/lib/devise/failure_app.rb +2 -0
  42. data/lib/devise/hooks/activatable.rb +2 -0
  43. data/lib/devise/hooks/csrf_cleaner.rb +2 -0
  44. data/lib/devise/hooks/forgetable.rb +2 -0
  45. data/lib/devise/hooks/lockable.rb +2 -0
  46. data/lib/devise/hooks/proxy.rb +2 -0
  47. data/lib/devise/hooks/rememberable.rb +2 -0
  48. data/lib/devise/hooks/timeoutable.rb +2 -0
  49. data/lib/devise/hooks/trackable.rb +2 -0
  50. data/lib/devise/mailers/helpers.rb +2 -0
  51. data/lib/devise/mapping.rb +2 -0
  52. data/lib/devise/models.rb +2 -0
  53. data/lib/devise/models/authenticatable.rb +4 -2
  54. data/lib/devise/models/confirmable.rb +3 -1
  55. data/lib/devise/models/database_authenticatable.rb +3 -1
  56. data/lib/devise/models/lockable.rb +8 -2
  57. data/lib/devise/models/omniauthable.rb +2 -0
  58. data/lib/devise/models/recoverable.rb +2 -0
  59. data/lib/devise/models/registerable.rb +2 -0
  60. data/lib/devise/models/rememberable.rb +3 -1
  61. data/lib/devise/models/timeoutable.rb +2 -0
  62. data/lib/devise/models/trackable.rb +3 -1
  63. data/lib/devise/models/validatable.rb +3 -1
  64. data/lib/devise/modules.rb +2 -0
  65. data/lib/devise/omniauth.rb +2 -0
  66. data/lib/devise/omniauth/config.rb +2 -0
  67. data/lib/devise/omniauth/url_helpers.rb +2 -0
  68. data/lib/devise/orm/active_record.rb +2 -0
  69. data/lib/devise/orm/mongoid.rb +2 -0
  70. data/lib/devise/parameter_filter.rb +2 -0
  71. data/lib/devise/parameter_sanitizer.rb +2 -0
  72. data/lib/devise/rails.rb +2 -0
  73. data/lib/devise/rails/routes.rb +2 -0
  74. data/lib/devise/rails/warden_compat.rb +2 -0
  75. data/lib/devise/strategies/authenticatable.rb +2 -0
  76. data/lib/devise/strategies/base.rb +2 -0
  77. data/lib/devise/strategies/database_authenticatable.rb +2 -0
  78. data/lib/devise/strategies/rememberable.rb +2 -0
  79. data/lib/devise/test/controller_helpers.rb +2 -0
  80. data/lib/devise/test/integration_helpers.rb +2 -0
  81. data/lib/devise/test_helpers.rb +2 -0
  82. data/lib/devise/time_inflector.rb +2 -0
  83. data/lib/devise/token_generator.rb +2 -0
  84. data/lib/devise/version.rb +3 -1
  85. data/lib/generators/active_record/devise_generator.rb +15 -2
  86. data/lib/generators/active_record/templates/migration.rb +3 -1
  87. data/lib/generators/active_record/templates/migration_existing.rb +2 -0
  88. data/lib/generators/devise/controllers_generator.rb +2 -0
  89. data/lib/generators/devise/devise_generator.rb +4 -2
  90. data/lib/generators/devise/install_generator.rb +2 -0
  91. data/lib/generators/devise/orm_helpers.rb +7 -1
  92. data/lib/generators/devise/views_generator.rb +7 -8
  93. data/lib/generators/mongoid/devise_generator.rb +2 -0
  94. data/lib/generators/templates/controllers/confirmations_controller.rb +2 -0
  95. data/lib/generators/templates/controllers/omniauth_callbacks_controller.rb +2 -0
  96. data/lib/generators/templates/controllers/passwords_controller.rb +2 -0
  97. data/lib/generators/templates/controllers/registrations_controller.rb +2 -0
  98. data/lib/generators/templates/controllers/sessions_controller.rb +2 -0
  99. data/lib/generators/templates/controllers/unlocks_controller.rb +2 -0
  100. data/lib/generators/templates/devise.rb +2 -0
  101. data/test/controllers/custom_registrations_controller_test.rb +2 -0
  102. data/test/controllers/custom_strategy_test.rb +2 -0
  103. data/test/controllers/helper_methods_test.rb +2 -0
  104. data/test/controllers/helpers_test.rb +2 -0
  105. data/test/controllers/inherited_controller_i18n_messages_test.rb +2 -0
  106. data/test/controllers/internal_helpers_test.rb +2 -0
  107. data/test/controllers/load_hooks_controller_test.rb +2 -0
  108. data/test/controllers/passwords_controller_test.rb +2 -0
  109. data/test/controllers/sessions_controller_test.rb +2 -0
  110. data/test/controllers/url_helpers_test.rb +2 -0
  111. data/test/delegator_test.rb +2 -0
  112. data/test/devise_test.rb +2 -0
  113. data/test/failure_app_test.rb +2 -0
  114. data/test/generators/active_record_generator_test.rb +47 -0
  115. data/test/generators/controllers_generator_test.rb +2 -0
  116. data/test/generators/devise_generator_test.rb +2 -0
  117. data/test/generators/install_generator_test.rb +2 -0
  118. data/test/generators/mongoid_generator_test.rb +2 -0
  119. data/test/generators/views_generator_test.rb +2 -0
  120. data/test/helpers/devise_helper_test.rb +2 -0
  121. data/test/integration/authenticatable_test.rb +15 -1
  122. data/test/integration/confirmable_test.rb +2 -0
  123. data/test/integration/database_authenticatable_test.rb +2 -0
  124. data/test/integration/http_authenticatable_test.rb +2 -0
  125. data/test/integration/lockable_test.rb +5 -3
  126. data/test/integration/mounted_engine_test.rb +2 -0
  127. data/test/integration/omniauthable_test.rb +2 -0
  128. data/test/integration/recoverable_test.rb +2 -0
  129. data/test/integration/registerable_test.rb +2 -0
  130. data/test/integration/rememberable_test.rb +2 -0
  131. data/test/integration/timeoutable_test.rb +2 -0
  132. data/test/integration/trackable_test.rb +2 -0
  133. data/test/mailers/confirmation_instructions_test.rb +2 -0
  134. data/test/mailers/email_changed_test.rb +2 -0
  135. data/test/mailers/mailer_test.rb +2 -0
  136. data/test/mailers/reset_password_instructions_test.rb +2 -0
  137. data/test/mailers/unlock_instructions_test.rb +2 -0
  138. data/test/mapping_test.rb +2 -0
  139. data/test/models/authenticatable_test.rb +2 -0
  140. data/test/models/confirmable_test.rb +2 -0
  141. data/test/models/database_authenticatable_test.rb +2 -0
  142. data/test/models/lockable_test.rb +2 -0
  143. data/test/models/omniauthable_test.rb +2 -0
  144. data/test/models/recoverable_test.rb +2 -0
  145. data/test/models/registerable_test.rb +2 -0
  146. data/test/models/rememberable_test.rb +2 -0
  147. data/test/models/serializable_test.rb +6 -0
  148. data/test/models/timeoutable_test.rb +2 -0
  149. data/test/models/trackable_test.rb +11 -0
  150. data/test/models/validatable_test.rb +4 -2
  151. data/test/models_test.rb +2 -0
  152. data/test/omniauth/config_test.rb +2 -0
  153. data/test/omniauth/url_helpers_test.rb +2 -0
  154. data/test/orm/active_record.rb +2 -0
  155. data/test/orm/mongoid.rb +3 -1
  156. data/test/parameter_sanitizer_test.rb +2 -0
  157. data/test/rails_app/app/active_record/admin.rb +2 -0
  158. data/test/rails_app/app/active_record/shim.rb +2 -0
  159. data/test/rails_app/app/active_record/user.rb +4 -0
  160. data/test/rails_app/app/active_record/user_on_engine.rb +2 -0
  161. data/test/rails_app/app/active_record/user_on_main_app.rb +2 -0
  162. data/test/rails_app/app/active_record/user_with_validations.rb +12 -0
  163. data/test/rails_app/app/active_record/user_without_email.rb +2 -0
  164. data/test/rails_app/app/controllers/admins/sessions_controller.rb +2 -0
  165. data/test/rails_app/app/controllers/admins_controller.rb +2 -0
  166. data/test/rails_app/app/controllers/application_controller.rb +2 -0
  167. data/test/rails_app/app/controllers/application_with_fake_engine.rb +2 -0
  168. data/test/rails_app/app/controllers/custom/registrations_controller.rb +2 -0
  169. data/test/rails_app/app/controllers/home_controller.rb +2 -0
  170. data/test/rails_app/app/controllers/publisher/registrations_controller.rb +2 -0
  171. data/test/rails_app/app/controllers/publisher/sessions_controller.rb +2 -0
  172. data/test/rails_app/app/controllers/users/omniauth_callbacks_controller.rb +2 -0
  173. data/test/rails_app/app/controllers/users_controller.rb +2 -0
  174. data/test/rails_app/app/helpers/application_helper.rb +2 -0
  175. data/test/rails_app/app/mailers/users/from_proc_mailer.rb +2 -0
  176. data/test/rails_app/app/mailers/users/mailer.rb +2 -0
  177. data/test/rails_app/app/mailers/users/reply_to_mailer.rb +2 -0
  178. data/test/rails_app/app/mongoid/admin.rb +2 -0
  179. data/test/rails_app/app/mongoid/shim.rb +2 -0
  180. data/test/rails_app/app/mongoid/user.rb +2 -0
  181. data/test/rails_app/app/mongoid/user_on_engine.rb +2 -0
  182. data/test/rails_app/app/mongoid/user_on_main_app.rb +2 -0
  183. data/test/rails_app/app/mongoid/user_with_validations.rb +37 -0
  184. data/test/rails_app/app/mongoid/user_without_email.rb +2 -0
  185. data/test/rails_app/config/application.rb +2 -0
  186. data/test/rails_app/config/boot.rb +2 -0
  187. data/test/rails_app/config/environment.rb +2 -0
  188. data/test/rails_app/config/environments/development.rb +2 -0
  189. data/test/rails_app/config/environments/production.rb +2 -0
  190. data/test/rails_app/config/environments/test.rb +2 -0
  191. data/test/rails_app/config/initializers/backtrace_silencers.rb +2 -0
  192. data/test/rails_app/config/initializers/devise.rb +2 -0
  193. data/test/rails_app/config/initializers/inflections.rb +2 -0
  194. data/test/rails_app/config/initializers/secret_token.rb +2 -0
  195. data/test/rails_app/config/initializers/session_store.rb +2 -0
  196. data/test/rails_app/config/routes.rb +2 -0
  197. data/test/rails_app/db/migrate/20100401102949_create_tables.rb +2 -0
  198. data/test/rails_app/db/schema.rb +2 -0
  199. data/test/rails_app/lib/shared_admin.rb +2 -0
  200. data/test/rails_app/lib/shared_user.rb +2 -0
  201. data/test/rails_app/lib/shared_user_without_email.rb +2 -0
  202. data/test/rails_app/lib/shared_user_without_omniauth.rb +2 -0
  203. data/test/rails_test.rb +2 -0
  204. data/test/routes_test.rb +2 -0
  205. data/test/support/action_controller/record_identifier.rb +2 -0
  206. data/test/support/assertions.rb +2 -0
  207. data/test/support/helpers.rb +6 -0
  208. data/test/support/http_method_compatibility.rb +2 -0
  209. data/test/support/integration.rb +2 -0
  210. data/test/support/webrat/integrations/rails.rb +2 -0
  211. data/test/test/controller_helpers_test.rb +2 -0
  212. data/test/test/integration_helpers_test.rb +2 -0
  213. data/test/test_helper.rb +2 -0
  214. data/test/test_models.rb +2 -0
  215. metadata +8 -3
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 0b580a525adc8af746c4f2f2c22f337f5a605bde
4
- data.tar.gz: e39fc8ecd5b3119f79d3f303889d204762d9248c
3
+ metadata.gz: 88289e9acf977a7ec40baba9cc607ad802dd6d7e
4
+ data.tar.gz: b197dc5fb03fed5d94eae9ac6e3a740d7cb3f10a
5
5
  SHA512:
6
- metadata.gz: 62ee6bfb4250f0d9af472a00f9ed0937dc9f7526acc97e5012c2c930fb15447f449aa881a1382e73d3b38bb68f7b4410b184c4135959b8c6beb369d35e745fce
7
- data.tar.gz: acfb853f1006f573987367481929057a28433fbfab1b731bea10f858fa9343ef85dbb3cdccea3f151389357141a6d2c5425b79419df4ba6926e75161117c90ab
6
+ metadata.gz: 84eef3b02c2b5ca07e7562ac7fa7bb310d465618e25aaa739e94ed96d1a4e4abfcaa997d61d6ca247d7580b661b1f81a9d49229c65deae0673254f5edee02ac8
7
+ data.tar.gz: e52854fb48db7795e89c3542df182842499982332a5f11c0a8f802262b3d67049f21bbed01311763f1b160e8e514077f1d75ce8c2ea8b1eb9828eba6f248f6c6
@@ -2,9 +2,10 @@ language: ruby
2
2
 
3
3
  rvm:
4
4
  - 2.1.10
5
- - 2.2.7
6
- - 2.3.4
7
- - 2.4.1
5
+ - 2.2.8
6
+ - 2.3.5
7
+ - 2.4.2
8
+ - 2.5.0
8
9
  - ruby-head
9
10
 
10
11
  gemfile:
@@ -17,7 +18,9 @@ matrix:
17
18
  exclude:
18
19
  - rvm: 2.1.10
19
20
  gemfile: Gemfile
20
- - rvm: 2.4.1
21
+ - rvm: 2.5.0
22
+ gemfile: gemfiles/Gemfile.rails-4.1-stable
23
+ - rvm: 2.4.2
21
24
  gemfile: gemfiles/Gemfile.rails-4.1-stable
22
25
  - rvm: ruby-head
23
26
  gemfile: gemfiles/Gemfile.rails-4.1-stable
@@ -43,7 +46,9 @@ env:
43
46
  - DEVISE_ORM=active_record
44
47
  - DEVISE_ORM=mongoid
45
48
 
46
- before_install: "rm ${BUNDLE_GEMFILE}.lock"
49
+ before_install:
50
+ - "rm ${BUNDLE_GEMFILE}.lock"
51
+ - gem update --system
47
52
 
48
53
  before_script: "bundle update"
49
54
 
@@ -1,3 +1,23 @@
1
+ ### Unreleased
2
+
3
+ ### 4.4.0 - 2017-12-29
4
+
5
+ * enhancements
6
+ * Add `frozen_string_literal` pragma comment to all Ruby files. (by @pat)
7
+ * Use `set_flash_method!` instead of `set_flash_method` in `Devise::OmniauthCallbacksController#failure`. (by @saichander17)
8
+ * Clarify how `store_location_for` modifies URIs. (by @olivierlacan)
9
+ * Move `failed_attempts` increment into its own function. by (@mobilutz)
10
+ * Add `autocomplete="email"` to email fields. by (@MikeRogers0)
11
+ * Add the ability to change the default migrations path introduced in Rails 5.0.3. (by @alexhifer)
12
+ * Delete unnecessary condition for helper method. (by @davydovanton)
13
+ * Support `id: :uuid` option for migrations. (by @filip373)
14
+
15
+ * bug fixes
16
+ * Fix syntax for MRI 2.5.0. (by @pat)
17
+ * Validations were being ignored on singup in the `Trackable#update_tracked_fields!` method. (by @AshleyFoster)
18
+ * Do not modify options for `#serializable_hash`. (by @guigs)
19
+ * 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)
20
+
1
21
  ### 4.3.0 - 2017-05-14
2
22
 
3
23
  * Enhancements
data/Gemfile CHANGED
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  source "https://rubygems.org"
2
4
 
3
5
  gemspec
@@ -14,9 +16,6 @@ gem "rails-controller-testing"
14
16
 
15
17
  gem "responders", "~> 2.1"
16
18
 
17
- # TODO: Remove this line when Rails 5.1.1 is released
18
- gem "minitest", "< 5.10.2"
19
-
20
19
  group :test do
21
20
  gem "omniauth-facebook"
22
21
  gem "omniauth-openid"
@@ -10,7 +10,7 @@ GIT
10
10
  PATH
11
11
  remote: .
12
12
  specs:
13
- devise (4.3.0)
13
+ devise (4.4.0)
14
14
  bcrypt (~> 3.0)
15
15
  orm_adapter (~> 0.1)
16
16
  railties (>= 4.1.0, < 5.2)
@@ -176,7 +176,6 @@ DEPENDENCIES
176
176
  activerecord-jdbcsqlite3-adapter
177
177
  devise!
178
178
  jruby-openssl
179
- minitest (< 5.10.2)
180
179
  mocha (~> 1.1)
181
180
  oauth2
182
181
  omniauth (~> 1.3)
@@ -191,4 +190,4 @@ DEPENDENCIES
191
190
  webrat (= 0.7.3)
192
191
 
193
192
  BUNDLED WITH
194
- 1.14.6
193
+ 1.15.3
@@ -0,0 +1,19 @@
1
+ ## Precheck
2
+
3
+ - Do not use the issues tracker for help or support, try Stack Overflow.
4
+ - For bugs, do a quick search and make sure the bug has not yet been reported
5
+ - Finally, be nice and have fun!
6
+
7
+ ## Environment
8
+
9
+ - Ruby **[version]**
10
+ - Rails **[version]**
11
+ - Devise **[version]**
12
+
13
+ ## Current behavior
14
+
15
+ Include code samples, errors, steps to reproduce the error and stacktraces if appropriate.
16
+
17
+ Will be even more helpful if you provide a sample application or a test case that reproduces the error.
18
+
19
+ ## Expected behavior
data/README.md CHANGED
@@ -27,6 +27,50 @@ It's composed of 10 modules:
27
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
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.
29
29
 
30
+ ## Table of Contents
31
+
32
+ <!-- TOC depthFrom:1 depthTo:6 withLinks:1 orderedList:0 -->
33
+
34
+ - [Information](#information)
35
+ - [The Devise wiki](#the-devise-wiki)
36
+ - [Bug reports](#bug-reports)
37
+ - [StackOverflow and Mailing List](#stackoverflow-and-mailing-list)
38
+ - [RDocs](#rdocs)
39
+ - [Example applications](#example-applications)
40
+ - [Extensions](#extensions)
41
+ - [Contributing](#contributing)
42
+ - [Starting with Rails?](#starting-with-rails)
43
+ - [Getting started](#getting-started)
44
+ - [Controller filters and helpers](#controller-filters-and-helpers)
45
+ - [Configuring Models](#configuring-models)
46
+ - [Strong Parameters](#strong-parameters)
47
+ - [Configuring views](#configuring-views)
48
+ - [Configuring controllers](#configuring-controllers)
49
+ - [Configuring routes](#configuring-routes)
50
+ - [I18n](#i18n)
51
+ - [Test helpers](#test-helpers)
52
+ - [Controller tests](#controller-tests)
53
+ - [Integration tests](#integration-tests)
54
+ - [OmniAuth](#omniauth)
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
+ - [ActiveJob Integration](#activejob-integration)
62
+ - [Password reset tokens and Rails logs](#password-reset-tokens-and-rails-logs)
63
+ - [Other ORMs](#other-orms)
64
+ - [Additional information](#additional-information)
65
+ - [Heroku](#heroku)
66
+ - [Warden](#warden)
67
+ - [Contributors](#contributors)
68
+ - [License](#license)
69
+
70
+ <!-- /TOC -->
71
+
72
+
73
+
30
74
  ## Information
31
75
 
32
76
  ### The Devise wiki
@@ -126,7 +170,7 @@ Next, check the MODEL for any additional configuration options you might want to
126
170
 
127
171
  Then run `rails db:migrate`
128
172
 
129
- You should restart your application after changing Devise's configuration options. Otherwise, you will run into strange errors, for example, users being unable to login and route helpers being undefined.
173
+ You should restart your application after changing Devise's configuration options (this includes stopping spring). Otherwise, you will run into strange errors, for example, users being unable to login and route helpers being undefined.
130
174
 
131
175
  ### Controller filters and helpers
132
176
 
@@ -216,7 +260,21 @@ class ApplicationController < ActionController::Base
216
260
  end
217
261
  ```
218
262
 
219
- The above works for any additional fields where the parameters are simple scalar types. If you have nested attributes (say you're using `accepts_nested_attributes_for`), then you will need to tell devise about those nestings and types. Devise allows you to completely change Devise defaults or invoke custom behaviour by passing a block:
263
+ The above works for any additional fields where the parameters are simple scalar types. If you have nested attributes (say you're using `accepts_nested_attributes_for`), then you will need to tell devise about those nestings and types:
264
+
265
+ ```ruby
266
+ class ApplicationController < ActionController::Base
267
+ before_action :configure_permitted_parameters, if: :devise_controller?
268
+
269
+ protected
270
+
271
+ def configure_permitted_parameters
272
+ devise_parameter_sanitizer.permit(:sign_up, keys: [:first_name, :last_name, address_attributes: [:country, :state, :city, :area, :postal_code]])
273
+ end
274
+ end
275
+ ```
276
+
277
+ Devise allows you to completely change Devise defaults or invoke custom behaviour by passing a block:
220
278
 
221
279
  To permit simple scalar values for username and email, use this
222
280
 
@@ -374,6 +432,12 @@ end
374
432
 
375
433
  This way, you tell Devise to use the scope `:user` when "/sign_in" is accessed. Notice `devise_scope` is also aliased as `as` in your router.
376
434
 
435
+ Please note: You will still need to add `devise_for` in your routes in order to use helper methods such as `current_user`.
436
+
437
+ ```ruby
438
+ devise_for :users, skip: :all
439
+ ```
440
+
377
441
  ### I18n
378
442
 
379
443
  Devise uses flash messages with I18n, in conjunction with the flash keys :notice and :alert. To customize your app, you can set up your locale file:
data/Rakefile CHANGED
@@ -1,4 +1,5 @@
1
1
  # encoding: UTF-8
2
+ # frozen_string_literal: true
2
3
 
3
4
  require 'bundler/gem_tasks'
4
5
  require 'rake/testtask'
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  class Devise::ConfirmationsController < DeviseController
2
4
  # GET /resource/confirmation/new
3
5
  def new
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  class Devise::OmniauthCallbacksController < DeviseController
2
4
  prepend_before_action { request.env["devise.skip_timeout"] = true }
3
5
 
@@ -6,7 +8,7 @@ class Devise::OmniauthCallbacksController < DeviseController
6
8
  end
7
9
 
8
10
  def failure
9
- set_flash_message :alert, :failure, kind: OmniAuth::Utils.camelize(failed_strategy.name), reason: failure_message
11
+ set_flash_message! :alert, :failure, kind: OmniAuth::Utils.camelize(failed_strategy.name), reason: failure_message
10
12
  redirect_to after_omniauth_failure_path_for(resource_name)
11
13
  end
12
14
 
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  class Devise::PasswordsController < DeviseController
2
4
  prepend_before_action :require_no_authentication
3
5
  # Render the #edit only if coming from a reset password email link
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  class Devise::RegistrationsController < DeviseController
2
4
  prepend_before_action :require_no_authentication, only: [:new, :create, :cancel]
3
5
  prepend_before_action :authenticate_scope!, only: [:edit, :update, :destroy]
@@ -5,7 +7,7 @@ class Devise::RegistrationsController < DeviseController
5
7
 
6
8
  # GET /resource/sign_up
7
9
  def new
8
- build_resource({})
10
+ build_resource
9
11
  yield resource if block_given?
10
12
  respond_with resource
11
13
  end
@@ -97,8 +99,8 @@ class Devise::RegistrationsController < DeviseController
97
99
 
98
100
  # Build a devise resource passing in the session. Useful to move
99
101
  # temporary session data to the newly created user.
100
- def build_resource(hash=nil)
101
- self.resource = resource_class.new_with_session(hash || {}, session)
102
+ def build_resource(hash = {})
103
+ self.resource = resource_class.new_with_session(hash, session)
102
104
  end
103
105
 
104
106
  # Signs in a user on sign up. You can overwrite this method in your own
@@ -1,8 +1,10 @@
1
+ # frozen_string_literal: true
2
+
1
3
  class Devise::SessionsController < DeviseController
2
4
  prepend_before_action :require_no_authentication, only: [:new, :create]
3
5
  prepend_before_action :allow_params_authentication!, only: :create
4
6
  prepend_before_action :verify_signed_out_user, only: :destroy
5
- prepend_before_action only: [:create, :destroy] { request.env["devise.skip_timeout"] = true }
7
+ prepend_before_action(only: [:create, :destroy]) { request.env["devise.skip_timeout"] = true }
6
8
 
7
9
  # GET /resource/sign_in
8
10
  def new
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  class Devise::UnlocksController < DeviseController
2
4
  prepend_before_action :require_no_authentication
3
5
 
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # All Devise controllers are inherited from here.
2
4
  class DeviseController < Devise.parent_controller.constantize
3
5
  include Devise::Controllers::ScopedViews
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module DeviseHelper
2
4
  # A simple way to show error messages for the current devise resource. If you need
3
5
  # to customize this method, you can either overwrite it in your application helpers or
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  if defined?(ActionMailer)
2
4
  class Devise::Mailer < Devise.parent_mailer.constantize
3
5
  include Devise::Mailers::Helpers
@@ -5,7 +5,7 @@
5
5
 
6
6
  <div class="field">
7
7
  <%= f.label :email %><br />
8
- <%= f.email_field :email, autofocus: true, value: (resource.pending_reconfirmation? ? resource.unconfirmed_email : resource.email) %>
8
+ <%= f.email_field :email, autofocus: true, autocomplete: "email", value: (resource.pending_reconfirmation? ? resource.unconfirmed_email : resource.email) %>
9
9
  </div>
10
10
 
11
11
  <div class="actions">
@@ -5,7 +5,7 @@
5
5
 
6
6
  <div class="field">
7
7
  <%= f.label :email %><br />
8
- <%= f.email_field :email, autofocus: true %>
8
+ <%= f.email_field :email, autofocus: true, autocomplete: "email" %>
9
9
  </div>
10
10
 
11
11
  <div class="actions">
@@ -5,7 +5,7 @@
5
5
 
6
6
  <div class="field">
7
7
  <%= f.label :email %><br />
8
- <%= f.email_field :email, autofocus: true %>
8
+ <%= f.email_field :email, autofocus: true, autocomplete: "email" %>
9
9
  </div>
10
10
 
11
11
  <% if devise_mapping.confirmable? && resource.pending_reconfirmation? %>
@@ -5,7 +5,7 @@
5
5
 
6
6
  <div class="field">
7
7
  <%= f.label :email %><br />
8
- <%= f.email_field :email, autofocus: true %>
8
+ <%= f.email_field :email, autofocus: true, autocomplete: "email" %>
9
9
  </div>
10
10
 
11
11
  <div class="field">
@@ -3,7 +3,7 @@
3
3
  <%= form_for(resource, as: resource_name, url: session_path(resource_name)) do |f| %>
4
4
  <div class="field">
5
5
  <%= f.label :email %><br />
6
- <%= f.email_field :email, autofocus: true %>
6
+ <%= f.email_field :email, autofocus: true, autocomplete: "email" %>
7
7
  </div>
8
8
 
9
9
  <div class="field">
@@ -5,7 +5,7 @@
5
5
 
6
6
  <div class="field">
7
7
  <%= f.label :email %><br />
8
- <%= f.email_field :email, autofocus: true %>
8
+ <%= f.email_field :email, autofocus: true, autocomplete: "email" %>
9
9
  </div>
10
10
 
11
11
  <div class="actions">
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # -*- encoding: utf-8 -*-
2
4
  $:.push File.expand_path("../lib", __FILE__)
3
5
  require "devise/version"
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  source "https://rubygems.org"
2
4
 
3
5
  gemspec path: ".."
@@ -5,7 +7,7 @@ gemspec path: ".."
5
7
  gem "rails", github: "rails/rails", branch: "4-1-stable"
6
8
  gem "omniauth"
7
9
  gem "omniauth-oauth2"
8
- gem "rdoc"
10
+ gem "rdoc", "~> 5.1"
9
11
 
10
12
  group :test do
11
13
  gem "omniauth-facebook"
@@ -21,7 +21,7 @@ GIT
21
21
  PATH
22
22
  remote: ..
23
23
  specs:
24
- devise (4.3.0)
24
+ devise (4.4.0)
25
25
  bcrypt (~> 3.0)
26
26
  orm_adapter (~> 0.1)
27
27
  railties (>= 4.1.0, < 5.2)
@@ -162,10 +162,10 @@ DEPENDENCIES
162
162
  omniauth-oauth2
163
163
  omniauth-openid
164
164
  rails!
165
- rdoc
165
+ rdoc (~> 5.1)
166
166
  sqlite3
167
167
  test_after_commit
168
168
  webrat (= 0.7.3)
169
169
 
170
170
  BUNDLED WITH
171
- 1.14.6
171
+ 1.15.3
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  source "https://rubygems.org"
2
4
 
3
5
  gemspec path: ".."
@@ -5,7 +7,7 @@ gemspec path: ".."
5
7
  gem "rails", github: "rails/rails", branch: "4-2-stable"
6
8
  gem "omniauth"
7
9
  gem "omniauth-oauth2"
8
- gem "rdoc"
10
+ gem "rdoc", "~> 5.1"
9
11
 
10
12
  group :test do
11
13
  gem "omniauth-facebook"