devise_token_auth 1.0.0 → 1.1.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (114) hide show
  1. checksums.yaml +5 -5
  2. data/README.md +4 -2
  3. data/app/controllers/devise_token_auth/application_controller.rb +2 -3
  4. data/app/controllers/devise_token_auth/concerns/resource_finder.rb +11 -12
  5. data/app/controllers/devise_token_auth/concerns/set_user_by_token.rb +39 -55
  6. data/app/controllers/devise_token_auth/confirmations_controller.rb +63 -20
  7. data/app/controllers/devise_token_auth/omniauth_callbacks_controller.rb +77 -29
  8. data/app/controllers/devise_token_auth/passwords_controller.rb +44 -30
  9. data/app/controllers/devise_token_auth/registrations_controller.rb +33 -40
  10. data/app/controllers/devise_token_auth/sessions_controller.rb +5 -5
  11. data/app/controllers/devise_token_auth/unlocks_controller.rb +4 -4
  12. data/app/models/devise_token_auth/concerns/active_record_support.rb +16 -0
  13. data/app/models/devise_token_auth/concerns/confirmable_support.rb +27 -0
  14. data/app/models/devise_token_auth/concerns/mongoid_support.rb +19 -0
  15. data/app/models/devise_token_auth/concerns/tokens_serialization.rb +19 -0
  16. data/app/models/devise_token_auth/concerns/user.rb +52 -71
  17. data/app/models/devise_token_auth/concerns/user_omniauth_callbacks.rb +3 -3
  18. data/app/validators/{email_validator.rb → devise_token_auth_email_validator.rb} +1 -1
  19. data/config/locales/da-DK.yml +2 -0
  20. data/config/locales/de.yml +2 -0
  21. data/config/locales/en.yml +7 -0
  22. data/config/locales/es.yml +2 -0
  23. data/config/locales/fr.yml +2 -0
  24. data/config/locales/he.yml +52 -0
  25. data/config/locales/it.yml +2 -0
  26. data/config/locales/ja.yml +4 -2
  27. data/config/locales/ko.yml +51 -0
  28. data/config/locales/nl.yml +2 -0
  29. data/config/locales/pl.yml +6 -3
  30. data/config/locales/pt-BR.yml +2 -0
  31. data/config/locales/pt.yml +6 -3
  32. data/config/locales/ro.yml +2 -0
  33. data/config/locales/ru.yml +2 -0
  34. data/config/locales/sq.yml +2 -0
  35. data/config/locales/sv.yml +2 -0
  36. data/config/locales/uk.yml +2 -0
  37. data/config/locales/vi.yml +2 -0
  38. data/config/locales/zh-CN.yml +2 -0
  39. data/config/locales/zh-HK.yml +2 -0
  40. data/config/locales/zh-TW.yml +2 -0
  41. data/lib/devise_token_auth.rb +6 -3
  42. data/lib/devise_token_auth/blacklist.rb +2 -0
  43. data/lib/devise_token_auth/engine.rb +7 -1
  44. data/lib/devise_token_auth/rails/routes.rb +1 -1
  45. data/lib/devise_token_auth/token_factory.rb +126 -0
  46. data/lib/devise_token_auth/url.rb +3 -0
  47. data/lib/devise_token_auth/version.rb +1 -1
  48. data/lib/generators/devise_token_auth/USAGE +1 -1
  49. data/lib/generators/devise_token_auth/install_generator.rb +6 -90
  50. data/lib/generators/devise_token_auth/install_generator_helpers.rb +98 -0
  51. data/lib/generators/devise_token_auth/install_mongoid_generator.rb +46 -0
  52. data/lib/generators/devise_token_auth/templates/devise_token_auth.rb +10 -0
  53. data/lib/generators/devise_token_auth/templates/devise_token_auth_create_users.rb.erb +0 -7
  54. data/lib/generators/devise_token_auth/templates/user.rb.erb +2 -2
  55. data/lib/generators/devise_token_auth/templates/user_mongoid.rb.erb +56 -0
  56. data/test/controllers/custom/custom_confirmations_controller_test.rb +1 -1
  57. data/test/controllers/demo_user_controller_test.rb +2 -2
  58. data/test/controllers/devise_token_auth/confirmations_controller_test.rb +83 -19
  59. data/test/controllers/devise_token_auth/omniauth_callbacks_controller_test.rb +109 -42
  60. data/test/controllers/devise_token_auth/passwords_controller_test.rb +227 -102
  61. data/test/controllers/devise_token_auth/registrations_controller_test.rb +34 -7
  62. data/test/controllers/devise_token_auth/sessions_controller_test.rb +0 -38
  63. data/test/controllers/devise_token_auth/token_validations_controller_test.rb +2 -1
  64. data/test/dummy/app/active_record/confirmable_user.rb +11 -0
  65. data/test/dummy/app/{models → active_record}/lockable_user.rb +0 -0
  66. data/test/dummy/app/{models → active_record}/mang.rb +0 -0
  67. data/test/dummy/app/{models → active_record}/only_email_user.rb +0 -0
  68. data/test/dummy/app/{models → active_record}/scoped_user.rb +2 -2
  69. data/test/dummy/app/{models → active_record}/unconfirmable_user.rb +1 -2
  70. data/test/dummy/app/{models → active_record}/unregisterable_user.rb +3 -3
  71. data/test/dummy/app/active_record/user.rb +6 -0
  72. data/test/dummy/app/controllers/overrides/confirmations_controller.rb +3 -3
  73. data/test/dummy/app/controllers/overrides/passwords_controller.rb +3 -3
  74. data/test/dummy/app/controllers/overrides/registrations_controller.rb +1 -1
  75. data/test/dummy/app/controllers/overrides/sessions_controller.rb +2 -2
  76. data/test/dummy/app/models/{user.rb → concerns/favorite_color.rb} +7 -8
  77. data/test/dummy/app/mongoid/confirmable_user.rb +52 -0
  78. data/test/dummy/app/mongoid/lockable_user.rb +38 -0
  79. data/test/dummy/app/mongoid/mang.rb +46 -0
  80. data/test/dummy/app/mongoid/only_email_user.rb +33 -0
  81. data/test/dummy/app/mongoid/scoped_user.rb +50 -0
  82. data/test/dummy/app/mongoid/unconfirmable_user.rb +44 -0
  83. data/test/dummy/app/mongoid/unregisterable_user.rb +47 -0
  84. data/test/dummy/app/mongoid/user.rb +49 -0
  85. data/test/dummy/config/application.rb +23 -1
  86. data/test/dummy/config/boot.rb +4 -0
  87. data/test/dummy/config/initializers/devise.rb +285 -0
  88. data/test/dummy/config/initializers/devise_token_auth.rb +35 -4
  89. data/test/dummy/config/initializers/figaro.rb +1 -1
  90. data/test/dummy/config/initializers/omniauth.rb +1 -0
  91. data/test/dummy/config/routes.rb +2 -0
  92. data/test/dummy/db/migrate/20140715061447_devise_token_auth_create_users.rb +0 -7
  93. data/test/dummy/db/migrate/20140715061805_devise_token_auth_create_mangs.rb +0 -7
  94. data/test/dummy/db/migrate/20141222035835_devise_token_auth_create_only_email_users.rb +0 -7
  95. data/test/dummy/db/migrate/20141222053502_devise_token_auth_create_unregisterable_users.rb +0 -7
  96. data/test/dummy/db/migrate/20150708104536_devise_token_auth_create_unconfirmable_users.rb +0 -7
  97. data/test/dummy/db/migrate/20160103235141_devise_token_auth_create_scoped_users.rb +0 -7
  98. data/test/dummy/db/migrate/20160629184441_devise_token_auth_create_lockable_users.rb +0 -7
  99. data/test/dummy/db/migrate/20190924101113_devise_token_auth_create_confirmable_users.rb +49 -0
  100. data/test/dummy/db/schema.rb +26 -28
  101. data/test/factories/users.rb +3 -2
  102. data/test/lib/devise_token_auth/blacklist_test.rb +11 -0
  103. data/test/lib/devise_token_auth/token_factory_test.rb +191 -0
  104. data/test/lib/devise_token_auth/url_test.rb +2 -2
  105. data/test/lib/generators/devise_token_auth/install_generator_test.rb +51 -31
  106. data/test/lib/generators/devise_token_auth/install_generator_with_namespace_test.rb +51 -31
  107. data/test/models/concerns/mongoid_support_test.rb +31 -0
  108. data/test/models/concerns/tokens_serialization_test.rb +70 -0
  109. data/test/models/confirmable_user_test.rb +35 -0
  110. data/test/models/only_email_user_test.rb +0 -8
  111. data/test/models/user_test.rb +1 -33
  112. data/test/test_helper.rb +13 -3
  113. metadata +129 -26
  114. data/config/initializers/devise.rb +0 -198
@@ -7,11 +7,15 @@ SimpleCov.start 'rails' do
7
7
  end
8
8
 
9
9
  ENV['RAILS_ENV'] = 'test'
10
+ DEVISE_TOKEN_AUTH_ORM = (ENV['DEVISE_TOKEN_AUTH_ORM'] || :active_record).to_sym
11
+
12
+ puts "\n==> DeviseTokenAuth.orm = #{DEVISE_TOKEN_AUTH_ORM.inspect}"
10
13
 
11
14
  require File.expand_path('dummy/config/environment', __dir__)
12
- require 'rails/test_help'
15
+ require 'active_support/testing/autorun'
13
16
  require 'minitest/rails'
14
17
  require 'mocha/minitest'
18
+ require 'database_cleaner'
15
19
 
16
20
  FactoryBot.definition_file_paths = [File.expand_path('factories', __dir__)]
17
21
  FactoryBot.find_definitions
@@ -30,13 +34,19 @@ end
30
34
  class ActiveSupport::TestCase
31
35
  include FactoryBot::Syntax::Methods
32
36
 
33
- ActiveRecord::Migration.check_pending!
37
+ ActiveRecord::Migration.check_pending! if DEVISE_TOKEN_AUTH_ORM == :active_record
38
+
39
+ strategies = { active_record: :transaction,
40
+ mongoid: :truncation }
41
+ DatabaseCleaner.strategy = strategies[DEVISE_TOKEN_AUTH_ORM]
42
+ setup { DatabaseCleaner.start }
43
+ teardown { DatabaseCleaner.clean }
34
44
 
35
45
  # Add more helper methods to be used by all tests here...
36
46
 
37
47
  def age_token(user, client_id)
38
48
  if user.tokens[client_id]
39
- user.tokens[client_id]['updated_at'] = Time.zone.now - (DeviseTokenAuth.batch_request_buffer_throttle + 10.seconds)
49
+ user.tokens[client_id]['updated_at'] = (Time.zone.now - (DeviseTokenAuth.batch_request_buffer_throttle + 10.seconds)).to_s(:rfc822)
40
50
  user.save!
41
51
  end
42
52
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: devise_token_auth
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.1.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Lynn Hurley
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-10-23 00:00:00.000000000 Z
11
+ date: 2020-06-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -19,7 +19,7 @@ dependencies:
19
19
  version: 4.2.0
20
20
  - - "<"
21
21
  - !ruby/object:Gem::Version
22
- version: '6'
22
+ version: '6.1'
23
23
  type: :runtime
24
24
  prerelease: false
25
25
  version_requirements: !ruby/object:Gem::Requirement
@@ -29,7 +29,21 @@ dependencies:
29
29
  version: 4.2.0
30
30
  - - "<"
31
31
  - !ruby/object:Gem::Version
32
- version: '6'
32
+ version: '6.1'
33
+ - !ruby/object:Gem::Dependency
34
+ name: sprockets
35
+ requirement: !ruby/object:Gem::Requirement
36
+ requirements:
37
+ - - '='
38
+ - !ruby/object:Gem::Version
39
+ version: 3.7.2
40
+ type: :runtime
41
+ prerelease: false
42
+ version_requirements: !ruby/object:Gem::Requirement
43
+ requirements:
44
+ - - '='
45
+ - !ruby/object:Gem::Version
46
+ version: 3.7.2
33
47
  - !ruby/object:Gem::Dependency
34
48
  name: devise
35
49
  requirement: !ruby/object:Gem::Requirement
@@ -39,7 +53,7 @@ dependencies:
39
53
  version: 3.5.2
40
54
  - - "<"
41
55
  - !ruby/object:Gem::Version
42
- version: '4.6'
56
+ version: '5'
43
57
  type: :runtime
44
58
  prerelease: false
45
59
  version_requirements: !ruby/object:Gem::Requirement
@@ -49,7 +63,21 @@ dependencies:
49
63
  version: 3.5.2
50
64
  - - "<"
51
65
  - !ruby/object:Gem::Version
52
- version: '4.6'
66
+ version: '5'
67
+ - !ruby/object:Gem::Dependency
68
+ name: bcrypt
69
+ requirement: !ruby/object:Gem::Requirement
70
+ requirements:
71
+ - - "~>"
72
+ - !ruby/object:Gem::Version
73
+ version: '3.0'
74
+ type: :runtime
75
+ prerelease: false
76
+ version_requirements: !ruby/object:Gem::Requirement
77
+ requirements:
78
+ - - "~>"
79
+ - !ruby/object:Gem::Version
80
+ version: '3.0'
53
81
  - !ruby/object:Gem::Dependency
54
82
  name: appraisal
55
83
  requirement: !ruby/object:Gem::Requirement
@@ -70,14 +98,14 @@ dependencies:
70
98
  requirements:
71
99
  - - "~>"
72
100
  - !ruby/object:Gem::Version
73
- version: '1.3'
101
+ version: '1.4'
74
102
  type: :development
75
103
  prerelease: false
76
104
  version_requirements: !ruby/object:Gem::Requirement
77
105
  requirements:
78
106
  - - "~>"
79
107
  - !ruby/object:Gem::Version
80
- version: '1.3'
108
+ version: '1.4'
81
109
  - !ruby/object:Gem::Dependency
82
110
  name: pg
83
111
  requirement: !ruby/object:Gem::Requirement
@@ -106,6 +134,40 @@ dependencies:
106
134
  - - ">="
107
135
  - !ruby/object:Gem::Version
108
136
  version: '0'
137
+ - !ruby/object:Gem::Dependency
138
+ name: mongoid
139
+ requirement: !ruby/object:Gem::Requirement
140
+ requirements:
141
+ - - ">="
142
+ - !ruby/object:Gem::Version
143
+ version: '4'
144
+ - - "<"
145
+ - !ruby/object:Gem::Version
146
+ version: '8'
147
+ type: :development
148
+ prerelease: false
149
+ version_requirements: !ruby/object:Gem::Requirement
150
+ requirements:
151
+ - - ">="
152
+ - !ruby/object:Gem::Version
153
+ version: '4'
154
+ - - "<"
155
+ - !ruby/object:Gem::Version
156
+ version: '8'
157
+ - !ruby/object:Gem::Dependency
158
+ name: mongoid-locker
159
+ requirement: !ruby/object:Gem::Requirement
160
+ requirements:
161
+ - - "~>"
162
+ - !ruby/object:Gem::Version
163
+ version: '1.0'
164
+ type: :development
165
+ prerelease: false
166
+ version_requirements: !ruby/object:Gem::Requirement
167
+ requirements:
168
+ - - "~>"
169
+ - !ruby/object:Gem::Version
170
+ version: '1.0'
109
171
  description: For use with client side single page apps such as the venerable https://github.com/lynndylanhurley/ng-token-auth.
110
172
  email:
111
173
  - lynn.dylan.hurley@gmail.com
@@ -126,21 +188,26 @@ files:
126
188
  - app/controllers/devise_token_auth/sessions_controller.rb
127
189
  - app/controllers/devise_token_auth/token_validations_controller.rb
128
190
  - app/controllers/devise_token_auth/unlocks_controller.rb
191
+ - app/models/devise_token_auth/concerns/active_record_support.rb
192
+ - app/models/devise_token_auth/concerns/confirmable_support.rb
193
+ - app/models/devise_token_auth/concerns/mongoid_support.rb
194
+ - app/models/devise_token_auth/concerns/tokens_serialization.rb
129
195
  - app/models/devise_token_auth/concerns/user.rb
130
196
  - app/models/devise_token_auth/concerns/user_omniauth_callbacks.rb
131
- - app/validators/email_validator.rb
197
+ - app/validators/devise_token_auth_email_validator.rb
132
198
  - app/views/devise/mailer/confirmation_instructions.html.erb
133
199
  - app/views/devise/mailer/reset_password_instructions.html.erb
134
200
  - app/views/devise/mailer/unlock_instructions.html.erb
135
201
  - app/views/devise_token_auth/omniauth_external_window.html.erb
136
- - config/initializers/devise.rb
137
202
  - config/locales/da-DK.yml
138
203
  - config/locales/de.yml
139
204
  - config/locales/en.yml
140
205
  - config/locales/es.yml
141
206
  - config/locales/fr.yml
207
+ - config/locales/he.yml
142
208
  - config/locales/it.yml
143
209
  - config/locales/ja.yml
210
+ - config/locales/ko.yml
144
211
  - config/locales/nl.yml
145
212
  - config/locales/pl.yml
146
213
  - config/locales/pt-BR.yml
@@ -155,19 +222,24 @@ files:
155
222
  - config/locales/zh-HK.yml
156
223
  - config/locales/zh-TW.yml
157
224
  - lib/devise_token_auth.rb
225
+ - lib/devise_token_auth/blacklist.rb
158
226
  - lib/devise_token_auth/controllers/helpers.rb
159
227
  - lib/devise_token_auth/controllers/url_helpers.rb
160
228
  - lib/devise_token_auth/engine.rb
161
229
  - lib/devise_token_auth/errors.rb
162
230
  - lib/devise_token_auth/rails/routes.rb
231
+ - lib/devise_token_auth/token_factory.rb
163
232
  - lib/devise_token_auth/url.rb
164
233
  - lib/devise_token_auth/version.rb
165
234
  - lib/generators/devise_token_auth/USAGE
166
235
  - lib/generators/devise_token_auth/install_generator.rb
236
+ - lib/generators/devise_token_auth/install_generator_helpers.rb
237
+ - lib/generators/devise_token_auth/install_mongoid_generator.rb
167
238
  - lib/generators/devise_token_auth/install_views_generator.rb
168
239
  - lib/generators/devise_token_auth/templates/devise_token_auth.rb
169
240
  - lib/generators/devise_token_auth/templates/devise_token_auth_create_users.rb.erb
170
241
  - lib/generators/devise_token_auth/templates/user.rb.erb
242
+ - lib/generators/devise_token_auth/templates/user_mongoid.rb.erb
171
243
  - lib/tasks/devise_token_auth_tasks.rake
172
244
  - test/controllers/custom/custom_confirmations_controller_test.rb
173
245
  - test/controllers/custom/custom_omniauth_callbacks_controller_test.rb
@@ -192,6 +264,14 @@ files:
192
264
  - test/controllers/overrides/sessions_controller_test.rb
193
265
  - test/controllers/overrides/token_validations_controller_test.rb
194
266
  - test/dummy/README.rdoc
267
+ - test/dummy/app/active_record/confirmable_user.rb
268
+ - test/dummy/app/active_record/lockable_user.rb
269
+ - test/dummy/app/active_record/mang.rb
270
+ - test/dummy/app/active_record/only_email_user.rb
271
+ - test/dummy/app/active_record/scoped_user.rb
272
+ - test/dummy/app/active_record/unconfirmable_user.rb
273
+ - test/dummy/app/active_record/unregisterable_user.rb
274
+ - test/dummy/app/active_record/user.rb
195
275
  - test/dummy/app/controllers/application_controller.rb
196
276
  - test/dummy/app/controllers/auth_origin_controller.rb
197
277
  - test/dummy/app/controllers/custom/confirmations_controller.rb
@@ -210,13 +290,15 @@ files:
210
290
  - test/dummy/app/controllers/overrides/sessions_controller.rb
211
291
  - test/dummy/app/controllers/overrides/token_validations_controller.rb
212
292
  - test/dummy/app/helpers/application_helper.rb
213
- - test/dummy/app/models/lockable_user.rb
214
- - test/dummy/app/models/mang.rb
215
- - test/dummy/app/models/only_email_user.rb
216
- - test/dummy/app/models/scoped_user.rb
217
- - test/dummy/app/models/unconfirmable_user.rb
218
- - test/dummy/app/models/unregisterable_user.rb
219
- - test/dummy/app/models/user.rb
293
+ - test/dummy/app/models/concerns/favorite_color.rb
294
+ - test/dummy/app/mongoid/confirmable_user.rb
295
+ - test/dummy/app/mongoid/lockable_user.rb
296
+ - test/dummy/app/mongoid/mang.rb
297
+ - test/dummy/app/mongoid/only_email_user.rb
298
+ - test/dummy/app/mongoid/scoped_user.rb
299
+ - test/dummy/app/mongoid/unconfirmable_user.rb
300
+ - test/dummy/app/mongoid/unregisterable_user.rb
301
+ - test/dummy/app/mongoid/user.rb
220
302
  - test/dummy/app/views/layouts/application.html.erb
221
303
  - test/dummy/config.ru
222
304
  - test/dummy/config/application.rb
@@ -249,15 +331,21 @@ files:
249
331
  - test/dummy/db/migrate/20150708104536_devise_token_auth_create_unconfirmable_users.rb
250
332
  - test/dummy/db/migrate/20160103235141_devise_token_auth_create_scoped_users.rb
251
333
  - test/dummy/db/migrate/20160629184441_devise_token_auth_create_lockable_users.rb
334
+ - test/dummy/db/migrate/20190924101113_devise_token_auth_create_confirmable_users.rb
252
335
  - test/dummy/db/schema.rb
253
336
  - test/dummy/lib/migration_database_helper.rb
254
337
  - test/dummy/tmp/generators/app/views/devise/mailer/confirmation_instructions.html.erb
255
338
  - test/dummy/tmp/generators/app/views/devise/mailer/reset_password_instructions.html.erb
256
339
  - test/factories/users.rb
340
+ - test/lib/devise_token_auth/blacklist_test.rb
341
+ - test/lib/devise_token_auth/token_factory_test.rb
257
342
  - test/lib/devise_token_auth/url_test.rb
258
343
  - test/lib/generators/devise_token_auth/install_generator_test.rb
259
344
  - test/lib/generators/devise_token_auth/install_generator_with_namespace_test.rb
260
345
  - test/lib/generators/devise_token_auth/install_views_generator_test.rb
346
+ - test/models/concerns/mongoid_support_test.rb
347
+ - test/models/concerns/tokens_serialization_test.rb
348
+ - test/models/confirmable_user_test.rb
261
349
  - test/models/only_email_user_test.rb
262
350
  - test/models/user_test.rb
263
351
  - test/support/controllers/routes.rb
@@ -281,19 +369,28 @@ required_rubygems_version: !ruby/object:Gem::Requirement
281
369
  - !ruby/object:Gem::Version
282
370
  version: '0'
283
371
  requirements: []
284
- rubyforge_project:
285
- rubygems_version: 2.6.14.1
372
+ rubygems_version: 3.0.3
286
373
  signing_key:
287
374
  specification_version: 4
288
375
  summary: Token based authentication for rails. Uses Devise + OmniAuth.
289
376
  test_files:
290
- - test/dummy/app/models/only_email_user.rb
291
- - test/dummy/app/models/scoped_user.rb
292
- - test/dummy/app/models/mang.rb
293
- - test/dummy/app/models/unregisterable_user.rb
294
- - test/dummy/app/models/lockable_user.rb
295
- - test/dummy/app/models/unconfirmable_user.rb
296
- - test/dummy/app/models/user.rb
377
+ - test/dummy/app/mongoid/only_email_user.rb
378
+ - test/dummy/app/mongoid/scoped_user.rb
379
+ - test/dummy/app/mongoid/confirmable_user.rb
380
+ - test/dummy/app/mongoid/mang.rb
381
+ - test/dummy/app/mongoid/unregisterable_user.rb
382
+ - test/dummy/app/mongoid/lockable_user.rb
383
+ - test/dummy/app/mongoid/unconfirmable_user.rb
384
+ - test/dummy/app/mongoid/user.rb
385
+ - test/dummy/app/models/concerns/favorite_color.rb
386
+ - test/dummy/app/active_record/only_email_user.rb
387
+ - test/dummy/app/active_record/scoped_user.rb
388
+ - test/dummy/app/active_record/confirmable_user.rb
389
+ - test/dummy/app/active_record/mang.rb
390
+ - test/dummy/app/active_record/unregisterable_user.rb
391
+ - test/dummy/app/active_record/lockable_user.rb
392
+ - test/dummy/app/active_record/unconfirmable_user.rb
393
+ - test/dummy/app/active_record/user.rb
297
394
  - test/dummy/app/controllers/overrides/token_validations_controller.rb
298
395
  - test/dummy/app/controllers/overrides/omniauth_callbacks_controller.rb
299
396
  - test/dummy/app/controllers/overrides/passwords_controller.rb
@@ -346,14 +443,20 @@ test_files:
346
443
  - test/dummy/db/migrate/20160103235141_devise_token_auth_create_scoped_users.rb
347
444
  - test/dummy/db/migrate/20140715061447_devise_token_auth_create_users.rb
348
445
  - test/dummy/db/migrate/20140715061805_devise_token_auth_create_mangs.rb
446
+ - test/dummy/db/migrate/20190924101113_devise_token_auth_create_confirmable_users.rb
349
447
  - test/dummy/tmp/generators/app/views/devise/mailer/confirmation_instructions.html.erb
350
448
  - test/dummy/tmp/generators/app/views/devise/mailer/reset_password_instructions.html.erb
351
449
  - test/dummy/README.rdoc
352
450
  - test/models/only_email_user_test.rb
451
+ - test/models/confirmable_user_test.rb
452
+ - test/models/concerns/mongoid_support_test.rb
453
+ - test/models/concerns/tokens_serialization_test.rb
353
454
  - test/models/user_test.rb
354
455
  - test/support/controllers/routes.rb
355
456
  - test/factories/users.rb
356
457
  - test/lib/devise_token_auth/url_test.rb
458
+ - test/lib/devise_token_auth/blacklist_test.rb
459
+ - test/lib/devise_token_auth/token_factory_test.rb
357
460
  - test/lib/generators/devise_token_auth/install_generator_test.rb
358
461
  - test/lib/generators/devise_token_auth/install_views_generator_test.rb
359
462
  - test/lib/generators/devise_token_auth/install_generator_with_namespace_test.rb
@@ -1,198 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- # Use this hook to configure devise mailer, warden hooks and so forth.
4
- # Many of these configuration options can be set straight in your model.
5
- Devise.setup do |config|
6
- # The secret key used by Devise. Devise uses this key to generate
7
- # random tokens. Changing this key will render invalid all existing
8
- # confirmation, reset password and unlock tokens in the database.
9
- # config.secret_key = 'd029dbc7262359b4f9906ec029bae825981dee112d9a1425643719765c8fd4884f12a37add35607fa3fa2d6fa6945a0077d7fe0f10a67f8ee66d69e9cc6ac19b'
10
-
11
- # ==> Mailer Configuration
12
- # Configure the e-mail address which will be shown in Devise::Mailer,
13
- # note that it will be overwritten if you use your own mailer class
14
- # with default "from" parameter.
15
- config.mailer_sender = 'no-reply@example.com'
16
-
17
- # Configure the class responsible to send e-mails.
18
- # config.mailer = 'Devise::Mailer'
19
-
20
- # ==> ORM configuration
21
- # Load and configure the ORM. Supports :active_record (default) and
22
- # :mongoid (bson_ext recommended) by default. Other ORMs may be
23
- # available as additional gems.
24
- require 'devise/orm/active_record'
25
-
26
- # ==> Configuration for any authentication mechanism
27
- # Configure which keys are used when authenticating a user. The default is
28
- # just :email. You can configure it to use [:username, :subdomain], so for
29
- # authenticating a user, both parameters are required. Remember that those
30
- # parameters are used only when authenticating and not when retrieving from
31
- # session. If you need permissions, you should implement that in a before filter.
32
- # You can also supply a hash where the value is a boolean determining whether
33
- # or not authentication should be aborted when the value is not present.
34
- # config.authentication_keys = [ :email ]
35
-
36
- # Configure parameters from the request object used for authentication. Each entry
37
- # given should be a request method and it will automatically be passed to the
38
- # find_for_authentication method and considered in your model lookup. For instance,
39
- # if you set :request_keys to [:subdomain], :subdomain will be used on authentication.
40
- # The same considerations mentioned for authentication_keys also apply to request_keys.
41
- # config.request_keys = []
42
-
43
- # Configure which authentication keys should be case-insensitive.
44
- # These keys will be downcased upon creating or modifying a user and when used
45
- # to authenticate or find a user. Default is :email.
46
- config.case_insensitive_keys = [ :email ]
47
-
48
- # Configure which authentication keys should have whitespace stripped.
49
- # These keys will have whitespace before and after removed upon creating or
50
- # modifying a user and when used to authenticate or find a user. Default is :email.
51
- config.strip_whitespace_keys = [ :email ]
52
-
53
- # Tell if authentication through request.params is enabled. True by default.
54
- # It can be set to an array that will enable params authentication only for the
55
- # given strategies, for example, `config.params_authenticatable = [:database]` will
56
- # enable it only for database (email + password) authentication.
57
- # config.params_authenticatable = true
58
-
59
- # Tell if authentication through HTTP Auth is enabled. False by default.
60
- # It can be set to an array that will enable http authentication only for the
61
- # given strategies, for example, `config.http_authenticatable = [:database]` will
62
- # enable it only for database authentication. The supported strategies are:
63
- # :database = Support basic authentication with authentication key + password
64
- # config.http_authenticatable = false
65
-
66
- # If http headers should be returned for AJAX requests. True by default.
67
- # config.http_authenticatable_on_xhr = true
68
-
69
- # The realm used in Http Basic Authentication. 'Application' by default.
70
- # config.http_authentication_realm = 'Application'
71
-
72
- # It will change confirmation, password recovery and other workflows
73
- # to behave the same regardless if the e-mail provided was right or wrong.
74
- # Does not affect registerable.
75
- # config.paranoid = true
76
-
77
- # By default Devise will store the user in session. You can skip storage for
78
- # particular strategies by setting this option.
79
- # Notice that if you are skipping storage for all authentication paths, you
80
- # may want to disable generating routes to Devise's sessions controller by
81
- # passing skip: :sessions to `devise_for` in your config/routes.rb
82
- config.skip_session_storage = [:http_auth]
83
-
84
- # By default, Devise cleans up the CSRF token on authentication to
85
- # avoid CSRF token fixation attacks. This means that, when using AJAX
86
- # requests for sign in and sign up, you need to get a new CSRF token
87
- # from the server. You can disable this option at your own risk.
88
- # config.clean_up_csrf_token_on_authentication = true
89
-
90
- # ==> Configuration for :database_authenticatable
91
- # For bcrypt, this is the cost for hashing the password and defaults to 11. If
92
- # using other algorithms, it sets how many times you want the password to be hashed.
93
- #
94
- # Limiting the stretches to just one in testing will increase the performance of
95
- # your test suite dramatically. However, it is STRONGLY RECOMMENDED to not use
96
- # a value less than 10 in other environments. Note that, for bcrypt (the default
97
- # algorithm), the cost increases exponentially with the number of stretches (e.g.
98
- # a value of 20 is already extremely slow: approx. 60 seconds for 1 calculation).
99
- config.stretches = Rails.env.test? ? 1 : 11
100
-
101
- # Setup a pepper to generate the encrypted password.
102
- # config.pepper = '8ff086600aff82d68ff1e00d23c99c821e66652ec8c2a5b48f58de4a56b325cb532f6db660cf58fc5ecb473b9d851be8cd1badff0a1053bc9dc045f78b6e6772'
103
-
104
- # ==> Configuration for :confirmable
105
- # A period that the user is allowed to access the website even without
106
- # confirming their account. For instance, if set to 2.days, the user will be
107
- # able to access the website for two days without confirming their account,
108
- # access will be blocked just in the third day. Default is 0.days, meaning
109
- # the user cannot access the website without confirming their account.
110
- # config.allow_unconfirmed_access_for = 2.days
111
-
112
- # A period that the user is allowed to confirm their account before their
113
- # token becomes invalid. For example, if set to 3.days, the user can confirm
114
- # their account within 3 days after the mail was sent, but on the fourth day
115
- # their account can't be confirmed with the token any more.
116
- # Default is nil, meaning there is no restriction on how long a user can take
117
- # before confirming their account.
118
- # config.confirm_within = 3.days
119
-
120
- # If true, requires any email changes to be confirmed (exactly the same way as
121
- # initial account confirmation) to be applied. Requires additional unconfirmed_email
122
- # db field (see migrations). Until confirmed, new email is stored in
123
- # unconfirmed_email column, and copied to email column on successful confirmation.
124
- config.reconfirmable = true
125
-
126
- # Defines which key will be used when confirming an account
127
- # config.confirmation_keys = [ :email ]
128
-
129
- # ==> Configuration for :rememberable
130
- # The time the user will be remembered without asking for credentials again.
131
- # config.remember_for = 2.weeks
132
-
133
- # If true, extends the user's remember period when remembered via cookie.
134
- # config.extend_remember_period = false
135
-
136
- # Options to be passed to the created cookie. For instance, you can set
137
- # secure: true in order to force SSL only cookies.
138
- # config.rememberable_options = {}
139
-
140
- # ==> Configuration for :validatable
141
- # Range for password length.
142
- config.password_length = 8..128
143
-
144
- # Email regex used to validate email formats. It simply asserts that
145
- # one (and only one) @ exists in the given string. This is mainly
146
- # to give user feedback and not to assert the e-mail validity.
147
- config.email_regexp = /\A[^@\s]+@[^@\s]+\z/
148
-
149
- # ==> Configuration for :timeoutable
150
- # The time you want to timeout the user session without activity. After this
151
- # time the user will be asked for credentials again. Default is 30 minutes.
152
- # config.timeout_in = 30.minutes
153
-
154
- # If true, expires auth token on session timeout.
155
- # config.expire_auth_token_on_timeout = false
156
-
157
- # ==> Configuration for :lockable
158
- # Defines which strategy will be used to lock an account.
159
- # :failed_attempts = Locks an account after a number of failed attempts to sign in.
160
- # :none = No lock strategy. You should handle locking by yourself.
161
- # config.lock_strategy = :failed_attempts
162
-
163
- # Defines which key will be used when locking and unlocking an account
164
- # config.unlock_keys = [ :email ]
165
-
166
- # Defines which strategy will be used to unlock an account.
167
- # :email = Sends an unlock link to the user email
168
- # :time = Re-enables login after a certain amount of time (see :unlock_in below)
169
- # :both = Enables both strategies
170
- # :none = No unlock strategy. You should handle unlocking by yourself.
171
- # config.unlock_strategy = :both
172
-
173
- # Number of authentication tries before locking an account if lock_strategy
174
- # is failed attempts.
175
- # config.maximum_attempts = 20
176
-
177
- # Time interval to unlock the account if :time is enabled as unlock_strategy.
178
- # config.unlock_in = 1.hour
179
-
180
- # Warn on the last attempt before the account is locked.
181
- # config.last_attempt_warning = false
182
-
183
- # ==> Configuration for :recoverable
184
- #
185
- # Defines which key will be used when recovering the password for an account
186
- # config.reset_password_keys = [ :email ]
187
-
188
- # Time interval you can reset your password with a reset password key.
189
- # Don't put a too small interval or your users won't have the time to
190
- # change their passwords.
191
- config.reset_password_within = 6.hours
192
-
193
- # The default HTTP method used to sign out a resource. Default is :delete.
194
- config.sign_out_via = :delete
195
-
196
- # don't serialize tokens
197
- Devise::Models::Authenticatable::BLACKLIST_FOR_SERIALIZATION << :tokens
198
- end