devise 3.5.2 → 3.5.3
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.
- checksums.yaml +4 -4
- data/.travis.yml +2 -3
- data/CHANGELOG.md +17 -1
- data/CODE_OF_CONDUCT.md +22 -0
- data/CONTRIBUTING.md +2 -0
- data/Gemfile.lock +2 -2
- data/app/controllers/devise/passwords_controller.rb +1 -0
- data/app/mailers/devise/mailer.rb +4 -0
- data/app/views/devise/mailer/password_change.html.erb +3 -0
- data/app/views/devise/shared/_links.html.erb +1 -1
- data/config/locales/en.yml +2 -0
- data/gemfiles/Gemfile.rails-3.2-stable.lock +5 -2
- data/gemfiles/Gemfile.rails-4.0-stable.lock +5 -2
- data/gemfiles/Gemfile.rails-4.1-stable.lock +5 -2
- data/gemfiles/Gemfile.rails-4.2-stable.lock +5 -2
- data/lib/devise.rb +12 -3
- data/lib/devise/controllers/helpers.rb +12 -6
- data/lib/devise/failure_app.rb +17 -3
- data/lib/devise/hooks/timeoutable.rb +2 -1
- data/lib/devise/models.rb +1 -1
- data/lib/devise/models/confirmable.rb +2 -2
- data/lib/devise/models/database_authenticatable.rb +12 -2
- data/lib/devise/models/recoverable.rb +2 -6
- data/lib/devise/rails/routes.rb +17 -3
- data/lib/devise/strategies/authenticatable.rb +1 -1
- data/lib/devise/version.rb +1 -1
- data/lib/generators/devise/views_generator.rb +14 -3
- data/lib/generators/templates/devise.rb +3 -0
- data/lib/generators/templates/markerb/confirmation_instructions.markerb +1 -1
- data/lib/generators/templates/markerb/password_change.markerb +3 -0
- data/lib/generators/templates/markerb/reset_password_instructions.markerb +1 -1
- data/lib/generators/templates/markerb/unlock_instructions.markerb +1 -1
- data/test/controllers/helper_methods_test.rb +21 -0
- data/test/failure_app_test.rb +17 -0
- data/test/generators/views_generator_test.rb +7 -0
- data/test/integration/omniauthable_test.rb +11 -9
- data/test/integration/timeoutable_test.rb +12 -0
- data/test/models/confirmable_test.rb +10 -0
- data/test/models/database_authenticatable_test.rb +20 -0
- data/test/models/lockable_test.rb +1 -1
- data/test/models/recoverable_test.rb +23 -0
- data/test/models_test.rb +15 -6
- data/test/rails_app/app/active_record/user_without_email.rb +8 -0
- data/test/rails_app/app/mongoid/user_without_email.rb +33 -0
- data/test/rails_app/config/routes.rb +5 -0
- data/test/rails_app/lib/shared_user_without_email.rb +26 -0
- data/test/support/helpers.rb +4 -0
- metadata +33 -22
@@ -0,0 +1,33 @@
|
|
1
|
+
require "shared_user_without_email"
|
2
|
+
|
3
|
+
class UserWithoutEmail
|
4
|
+
include Mongoid::Document
|
5
|
+
include Shim
|
6
|
+
include SharedUserWithoutEmail
|
7
|
+
|
8
|
+
field :username, type: String
|
9
|
+
field :facebook_token, type: String
|
10
|
+
|
11
|
+
## Database authenticatable
|
12
|
+
field :email, type: String, default: ""
|
13
|
+
field :encrypted_password, type: String, default: ""
|
14
|
+
|
15
|
+
## Recoverable
|
16
|
+
field :reset_password_token, type: String
|
17
|
+
field :reset_password_sent_at, type: Time
|
18
|
+
|
19
|
+
## Rememberable
|
20
|
+
field :remember_created_at, type: Time
|
21
|
+
|
22
|
+
## Trackable
|
23
|
+
field :sign_in_count, type: Integer, default: 0
|
24
|
+
field :current_sign_in_at, type: Time
|
25
|
+
field :last_sign_in_at, type: Time
|
26
|
+
field :current_sign_in_ip, type: String
|
27
|
+
field :last_sign_in_ip, type: String
|
28
|
+
|
29
|
+
## Lockable
|
30
|
+
field :failed_attempts, type: Integer, default: 0 # Only if lock strategy is :failed_attempts
|
31
|
+
field :unlock_token, type: String # Only if unlock strategy is :email or :both
|
32
|
+
field :locked_at, type: Time
|
33
|
+
end
|
@@ -28,6 +28,11 @@ Rails.application.routes.draw do
|
|
28
28
|
router_name: :fake_engine,
|
29
29
|
module: :devise
|
30
30
|
|
31
|
+
devise_for :user_without_email,
|
32
|
+
class_name: 'UserWithoutEmail',
|
33
|
+
router_name: :main_app,
|
34
|
+
module: :devise
|
35
|
+
|
31
36
|
as :user do
|
32
37
|
get "/as/sign_in", to: "devise/sessions#new"
|
33
38
|
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
module SharedUserWithoutEmail
|
2
|
+
extend ActiveSupport::Concern
|
3
|
+
|
4
|
+
included do
|
5
|
+
# NOTE: This is missing :validatable and :confirmable, as they both require
|
6
|
+
# an email field at the moment. It is also missing :omniauthable because that
|
7
|
+
# adds unnecessary complexity to the setup
|
8
|
+
devise :database_authenticatable, :lockable, :recoverable,
|
9
|
+
:registerable, :rememberable, :timeoutable,
|
10
|
+
:trackable
|
11
|
+
end
|
12
|
+
|
13
|
+
# This test stub is a bit rubbish because it's tied very closely to the
|
14
|
+
# implementation where we care about this one case. However, completely
|
15
|
+
# removing the email field breaks "recoverable" tests completely, so we are
|
16
|
+
# just taking the approach here that "email" is something that is a not an
|
17
|
+
# ActiveRecord field.
|
18
|
+
def email_changed?
|
19
|
+
raise NoMethodError
|
20
|
+
end
|
21
|
+
|
22
|
+
def respond_to?(method_name, include_all=false)
|
23
|
+
return false if method_name.to_sym == :email_changed?
|
24
|
+
super(method_name, include_all)
|
25
|
+
end
|
26
|
+
end
|
data/test/support/helpers.rb
CHANGED
@@ -46,6 +46,10 @@ class ActiveSupport::TestCase
|
|
46
46
|
Admin.create!(valid_attributes)
|
47
47
|
end
|
48
48
|
|
49
|
+
def create_user_without_email(attributes={})
|
50
|
+
UserWithoutEmail.create!(valid_attributes(attributes))
|
51
|
+
end
|
52
|
+
|
49
53
|
# Execute the block setting the given values and restoring old values after
|
50
54
|
# the block is executed.
|
51
55
|
def swap(object, new_values)
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: devise
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.5.
|
4
|
+
version: 3.5.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- José Valim
|
@@ -9,96 +9,96 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2015-
|
12
|
+
date: 2015-12-10 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: warden
|
16
16
|
requirement: !ruby/object:Gem::Requirement
|
17
17
|
requirements:
|
18
|
-
- - ~>
|
18
|
+
- - "~>"
|
19
19
|
- !ruby/object:Gem::Version
|
20
20
|
version: 1.2.3
|
21
21
|
type: :runtime
|
22
22
|
prerelease: false
|
23
23
|
version_requirements: !ruby/object:Gem::Requirement
|
24
24
|
requirements:
|
25
|
-
- - ~>
|
25
|
+
- - "~>"
|
26
26
|
- !ruby/object:Gem::Version
|
27
27
|
version: 1.2.3
|
28
28
|
- !ruby/object:Gem::Dependency
|
29
29
|
name: orm_adapter
|
30
30
|
requirement: !ruby/object:Gem::Requirement
|
31
31
|
requirements:
|
32
|
-
- - ~>
|
32
|
+
- - "~>"
|
33
33
|
- !ruby/object:Gem::Version
|
34
34
|
version: '0.1'
|
35
35
|
type: :runtime
|
36
36
|
prerelease: false
|
37
37
|
version_requirements: !ruby/object:Gem::Requirement
|
38
38
|
requirements:
|
39
|
-
- - ~>
|
39
|
+
- - "~>"
|
40
40
|
- !ruby/object:Gem::Version
|
41
41
|
version: '0.1'
|
42
42
|
- !ruby/object:Gem::Dependency
|
43
43
|
name: bcrypt
|
44
44
|
requirement: !ruby/object:Gem::Requirement
|
45
45
|
requirements:
|
46
|
-
- - ~>
|
46
|
+
- - "~>"
|
47
47
|
- !ruby/object:Gem::Version
|
48
48
|
version: '3.0'
|
49
49
|
type: :runtime
|
50
50
|
prerelease: false
|
51
51
|
version_requirements: !ruby/object:Gem::Requirement
|
52
52
|
requirements:
|
53
|
-
- - ~>
|
53
|
+
- - "~>"
|
54
54
|
- !ruby/object:Gem::Version
|
55
55
|
version: '3.0'
|
56
56
|
- !ruby/object:Gem::Dependency
|
57
57
|
name: thread_safe
|
58
58
|
requirement: !ruby/object:Gem::Requirement
|
59
59
|
requirements:
|
60
|
-
- - ~>
|
60
|
+
- - "~>"
|
61
61
|
- !ruby/object:Gem::Version
|
62
62
|
version: '0.1'
|
63
63
|
type: :runtime
|
64
64
|
prerelease: false
|
65
65
|
version_requirements: !ruby/object:Gem::Requirement
|
66
66
|
requirements:
|
67
|
-
- - ~>
|
67
|
+
- - "~>"
|
68
68
|
- !ruby/object:Gem::Version
|
69
69
|
version: '0.1'
|
70
70
|
- !ruby/object:Gem::Dependency
|
71
71
|
name: railties
|
72
72
|
requirement: !ruby/object:Gem::Requirement
|
73
73
|
requirements:
|
74
|
-
- -
|
74
|
+
- - ">="
|
75
75
|
- !ruby/object:Gem::Version
|
76
76
|
version: 3.2.6
|
77
|
-
- - <
|
77
|
+
- - "<"
|
78
78
|
- !ruby/object:Gem::Version
|
79
79
|
version: '5'
|
80
80
|
type: :runtime
|
81
81
|
prerelease: false
|
82
82
|
version_requirements: !ruby/object:Gem::Requirement
|
83
83
|
requirements:
|
84
|
-
- -
|
84
|
+
- - ">="
|
85
85
|
- !ruby/object:Gem::Version
|
86
86
|
version: 3.2.6
|
87
|
-
- - <
|
87
|
+
- - "<"
|
88
88
|
- !ruby/object:Gem::Version
|
89
89
|
version: '5'
|
90
90
|
- !ruby/object:Gem::Dependency
|
91
91
|
name: responders
|
92
92
|
requirement: !ruby/object:Gem::Requirement
|
93
93
|
requirements:
|
94
|
-
- -
|
94
|
+
- - ">="
|
95
95
|
- !ruby/object:Gem::Version
|
96
96
|
version: '0'
|
97
97
|
type: :runtime
|
98
98
|
prerelease: false
|
99
99
|
version_requirements: !ruby/object:Gem::Requirement
|
100
100
|
requirements:
|
101
|
-
- -
|
101
|
+
- - ">="
|
102
102
|
- !ruby/object:Gem::Version
|
103
103
|
version: '0'
|
104
104
|
description: Flexible authentication solution for Rails with Warden
|
@@ -107,10 +107,11 @@ executables: []
|
|
107
107
|
extensions: []
|
108
108
|
extra_rdoc_files: []
|
109
109
|
files:
|
110
|
-
- .gitignore
|
111
|
-
- .travis.yml
|
112
|
-
- .yardopts
|
110
|
+
- ".gitignore"
|
111
|
+
- ".travis.yml"
|
112
|
+
- ".yardopts"
|
113
113
|
- CHANGELOG.md
|
114
|
+
- CODE_OF_CONDUCT.md
|
114
115
|
- CONTRIBUTING.md
|
115
116
|
- Gemfile
|
116
117
|
- Gemfile.lock
|
@@ -128,6 +129,7 @@ files:
|
|
128
129
|
- app/mailers/devise/mailer.rb
|
129
130
|
- app/views/devise/confirmations/new.html.erb
|
130
131
|
- app/views/devise/mailer/confirmation_instructions.html.erb
|
132
|
+
- app/views/devise/mailer/password_change.html.erb
|
131
133
|
- app/views/devise/mailer/reset_password_instructions.html.erb
|
132
134
|
- app/views/devise/mailer/unlock_instructions.html.erb
|
133
135
|
- app/views/devise/passwords/edit.html.erb
|
@@ -218,6 +220,7 @@ files:
|
|
218
220
|
- lib/generators/templates/controllers/unlocks_controller.rb
|
219
221
|
- lib/generators/templates/devise.rb
|
220
222
|
- lib/generators/templates/markerb/confirmation_instructions.markerb
|
223
|
+
- lib/generators/templates/markerb/password_change.markerb
|
221
224
|
- lib/generators/templates/markerb/reset_password_instructions.markerb
|
222
225
|
- lib/generators/templates/markerb/unlock_instructions.markerb
|
223
226
|
- lib/generators/templates/simple_form_for/confirmations/new.html.erb
|
@@ -231,6 +234,7 @@ files:
|
|
231
234
|
- script/s3-put
|
232
235
|
- test/controllers/custom_registrations_controller_test.rb
|
233
236
|
- test/controllers/custom_strategy_test.rb
|
237
|
+
- test/controllers/helper_methods_test.rb
|
234
238
|
- test/controllers/helpers_test.rb
|
235
239
|
- test/controllers/inherited_controller_i18n_messages_test.rb
|
236
240
|
- test/controllers/internal_helpers_test.rb
|
@@ -287,6 +291,7 @@ files:
|
|
287
291
|
- test/rails_app/app/active_record/user.rb
|
288
292
|
- test/rails_app/app/active_record/user_on_engine.rb
|
289
293
|
- test/rails_app/app/active_record/user_on_main_app.rb
|
294
|
+
- test/rails_app/app/active_record/user_without_email.rb
|
290
295
|
- test/rails_app/app/controllers/admins/sessions_controller.rb
|
291
296
|
- test/rails_app/app/controllers/admins_controller.rb
|
292
297
|
- test/rails_app/app/controllers/application_controller.rb
|
@@ -306,6 +311,7 @@ files:
|
|
306
311
|
- test/rails_app/app/mongoid/user.rb
|
307
312
|
- test/rails_app/app/mongoid/user_on_engine.rb
|
308
313
|
- test/rails_app/app/mongoid/user_on_main_app.rb
|
314
|
+
- test/rails_app/app/mongoid/user_without_email.rb
|
309
315
|
- test/rails_app/app/views/admins/index.html.erb
|
310
316
|
- test/rails_app/app/views/admins/sessions/new.html.erb
|
311
317
|
- test/rails_app/app/views/home/admin_dashboard.html.erb
|
@@ -339,6 +345,7 @@ files:
|
|
339
345
|
- test/rails_app/db/schema.rb
|
340
346
|
- test/rails_app/lib/shared_admin.rb
|
341
347
|
- test/rails_app/lib/shared_user.rb
|
348
|
+
- test/rails_app/lib/shared_user_without_email.rb
|
342
349
|
- test/rails_app/lib/shared_user_without_omniauth.rb
|
343
350
|
- test/rails_app/public/404.html
|
344
351
|
- test/rails_app/public/422.html
|
@@ -366,23 +373,24 @@ require_paths:
|
|
366
373
|
- lib
|
367
374
|
required_ruby_version: !ruby/object:Gem::Requirement
|
368
375
|
requirements:
|
369
|
-
- -
|
376
|
+
- - ">="
|
370
377
|
- !ruby/object:Gem::Version
|
371
378
|
version: 1.9.3
|
372
379
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
373
380
|
requirements:
|
374
|
-
- -
|
381
|
+
- - ">="
|
375
382
|
- !ruby/object:Gem::Version
|
376
383
|
version: '0'
|
377
384
|
requirements: []
|
378
385
|
rubyforge_project:
|
379
|
-
rubygems_version: 2.
|
386
|
+
rubygems_version: 2.4.5
|
380
387
|
signing_key:
|
381
388
|
specification_version: 4
|
382
389
|
summary: Flexible authentication solution for Rails with Warden
|
383
390
|
test_files:
|
384
391
|
- test/controllers/custom_registrations_controller_test.rb
|
385
392
|
- test/controllers/custom_strategy_test.rb
|
393
|
+
- test/controllers/helper_methods_test.rb
|
386
394
|
- test/controllers/helpers_test.rb
|
387
395
|
- test/controllers/inherited_controller_i18n_messages_test.rb
|
388
396
|
- test/controllers/internal_helpers_test.rb
|
@@ -439,6 +447,7 @@ test_files:
|
|
439
447
|
- test/rails_app/app/active_record/user.rb
|
440
448
|
- test/rails_app/app/active_record/user_on_engine.rb
|
441
449
|
- test/rails_app/app/active_record/user_on_main_app.rb
|
450
|
+
- test/rails_app/app/active_record/user_without_email.rb
|
442
451
|
- test/rails_app/app/controllers/admins/sessions_controller.rb
|
443
452
|
- test/rails_app/app/controllers/admins_controller.rb
|
444
453
|
- test/rails_app/app/controllers/application_controller.rb
|
@@ -458,6 +467,7 @@ test_files:
|
|
458
467
|
- test/rails_app/app/mongoid/user.rb
|
459
468
|
- test/rails_app/app/mongoid/user_on_engine.rb
|
460
469
|
- test/rails_app/app/mongoid/user_on_main_app.rb
|
470
|
+
- test/rails_app/app/mongoid/user_without_email.rb
|
461
471
|
- test/rails_app/app/views/admins/index.html.erb
|
462
472
|
- test/rails_app/app/views/admins/sessions/new.html.erb
|
463
473
|
- test/rails_app/app/views/home/admin_dashboard.html.erb
|
@@ -491,6 +501,7 @@ test_files:
|
|
491
501
|
- test/rails_app/db/schema.rb
|
492
502
|
- test/rails_app/lib/shared_admin.rb
|
493
503
|
- test/rails_app/lib/shared_user.rb
|
504
|
+
- test/rails_app/lib/shared_user_without_email.rb
|
494
505
|
- test/rails_app/lib/shared_user_without_omniauth.rb
|
495
506
|
- test/rails_app/public/404.html
|
496
507
|
- test/rails_app/public/422.html
|