devise-multi_email 2.0.1 → 3.0.0
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.
- checksums.yaml +5 -5
- data/.travis.yml +6 -5
- data/CHANGELOG.md +4 -0
- data/devise-multi_email.gemspec +1 -1
- data/examples/rails5_app/Gemfile.lock +30 -26
- data/examples/rails5_app/app/models/email.rb +2 -0
- data/examples/rails5_app/db/migrate/20170307140813_devise_create_users.rb +2 -2
- data/examples/rails5_app/db/schema.rb +1 -1
- data/gemfiles/rails_5_0.gemfile +1 -0
- data/gemfiles/rails_5_2.gemfile +5 -0
- data/lib/devise/multi_email/models/confirmable.rb +3 -3
- data/lib/devise/multi_email/models/validatable.rb +24 -7
- data/lib/devise/multi_email/parent_model_manager.rb +1 -1
- data/lib/devise/multi_email/version.rb +1 -1
- metadata +8 -8
- data/.simplecov +0 -6
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
|
-
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
2
|
+
SHA256:
|
|
3
|
+
metadata.gz: e1f6c20540e06ef03d433a86d14ee5f7300b94146a1b9019b2c81a88edc72925
|
|
4
|
+
data.tar.gz: 3e14cce59ae14f024bba1213c11b91bf90f839cfe0c01ed4f9fcf0bbdbdd1e12
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 3595bdad371be1ca01a2fc6563b8aaba6da01e9c8bca8cf7bec9933d5fb58a8b045cf7b2cddd3440aa7dd623cd64e1d11cc53d8bce1e874d14bed0f54cc39fdd
|
|
7
|
+
data.tar.gz: 7b75589a85f83282eacdaf95911ac75572e0bc2336fe8f1bcf46e700cab71ffdeb470d36a59c5db55ed132ee6f07449ba57d5a11d4f2efb455c749f127eeb8d3
|
data/.travis.yml
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
language: ruby
|
|
2
2
|
rvm:
|
|
3
|
-
- 2.
|
|
4
|
-
- 2.
|
|
3
|
+
- 2.4
|
|
4
|
+
- 2.5
|
|
5
|
+
- 2.6
|
|
5
6
|
gemfile:
|
|
6
|
-
- gemfiles/
|
|
7
|
-
- gemfiles/
|
|
8
|
-
before_install: gem install bundler
|
|
7
|
+
- gemfiles/rails_5_2.gemfile
|
|
8
|
+
- gemfiles/rails_5_1.gemfile
|
|
9
|
+
before_install: gem install bundler
|
data/CHANGELOG.md
CHANGED
data/devise-multi_email.gemspec
CHANGED
|
@@ -21,7 +21,7 @@ Gem::Specification.new do |spec|
|
|
|
21
21
|
|
|
22
22
|
spec.add_runtime_dependency 'devise'
|
|
23
23
|
|
|
24
|
-
spec.add_development_dependency 'bundler'
|
|
24
|
+
spec.add_development_dependency 'bundler'
|
|
25
25
|
spec.add_development_dependency 'rake', '~> 10.0'
|
|
26
26
|
spec.add_development_dependency 'rspec'
|
|
27
27
|
spec.add_development_dependency 'sqlite3'
|
|
@@ -39,15 +39,16 @@ GEM
|
|
|
39
39
|
minitest (~> 5.1)
|
|
40
40
|
tzinfo (~> 1.1)
|
|
41
41
|
arel (7.1.4)
|
|
42
|
-
bcrypt (3.1.
|
|
42
|
+
bcrypt (3.1.13)
|
|
43
43
|
builder (3.2.3)
|
|
44
44
|
byebug (9.0.6)
|
|
45
|
-
concurrent-ruby (1.
|
|
45
|
+
concurrent-ruby (1.1.5)
|
|
46
|
+
crass (1.0.4)
|
|
46
47
|
debug_inspector (0.0.2)
|
|
47
|
-
devise (4.
|
|
48
|
+
devise (4.7.1)
|
|
48
49
|
bcrypt (~> 3.0)
|
|
49
50
|
orm_adapter (~> 0.1)
|
|
50
|
-
railties (>= 4.1.0
|
|
51
|
+
railties (>= 4.1.0)
|
|
51
52
|
responders
|
|
52
53
|
warden (~> 1.2.3)
|
|
53
54
|
devise-encryptable (0.2.0)
|
|
@@ -56,10 +57,11 @@ GEM
|
|
|
56
57
|
devise
|
|
57
58
|
erubis (2.7.0)
|
|
58
59
|
execjs (2.7.0)
|
|
59
|
-
ffi (1.
|
|
60
|
+
ffi (1.11.1)
|
|
60
61
|
globalid (0.3.7)
|
|
61
62
|
activesupport (>= 4.1.0)
|
|
62
|
-
i18n (0.
|
|
63
|
+
i18n (0.9.5)
|
|
64
|
+
concurrent-ruby (~> 1.0)
|
|
63
65
|
jbuilder (2.6.3)
|
|
64
66
|
activesupport (>= 3.0.0, < 5.2)
|
|
65
67
|
multi_json (~> 1.2)
|
|
@@ -70,23 +72,24 @@ GEM
|
|
|
70
72
|
listen (3.0.8)
|
|
71
73
|
rb-fsevent (~> 0.9, >= 0.9.4)
|
|
72
74
|
rb-inotify (~> 0.9, >= 0.9.7)
|
|
73
|
-
loofah (2.0
|
|
75
|
+
loofah (2.3.0)
|
|
76
|
+
crass (~> 1.0.2)
|
|
74
77
|
nokogiri (>= 1.5.9)
|
|
75
78
|
mail (2.6.4)
|
|
76
79
|
mime-types (>= 1.16, < 4)
|
|
77
|
-
method_source (0.
|
|
80
|
+
method_source (0.9.2)
|
|
78
81
|
mime-types (3.1)
|
|
79
82
|
mime-types-data (~> 3.2015)
|
|
80
83
|
mime-types-data (3.2016.0521)
|
|
81
|
-
mini_portile2 (2.
|
|
82
|
-
minitest (5.
|
|
84
|
+
mini_portile2 (2.4.0)
|
|
85
|
+
minitest (5.12.2)
|
|
83
86
|
multi_json (1.12.1)
|
|
84
87
|
nio4r (2.0.0)
|
|
85
|
-
nokogiri (1.
|
|
86
|
-
mini_portile2 (~> 2.
|
|
88
|
+
nokogiri (1.10.4)
|
|
89
|
+
mini_portile2 (~> 2.4.0)
|
|
87
90
|
orm_adapter (0.5.0)
|
|
88
91
|
puma (3.7.1)
|
|
89
|
-
rack (2.0.
|
|
92
|
+
rack (2.0.7)
|
|
90
93
|
rack-test (0.6.3)
|
|
91
94
|
rack (>= 1.0)
|
|
92
95
|
rails (5.0.2)
|
|
@@ -101,23 +104,24 @@ GEM
|
|
|
101
104
|
bundler (>= 1.3.0, < 2.0)
|
|
102
105
|
railties (= 5.0.2)
|
|
103
106
|
sprockets-rails (>= 2.0.0)
|
|
104
|
-
rails-dom-testing (2.0.
|
|
105
|
-
activesupport (>= 4.2.0
|
|
106
|
-
nokogiri (
|
|
107
|
-
rails-html-sanitizer (1.0
|
|
108
|
-
loofah (~> 2.
|
|
107
|
+
rails-dom-testing (2.0.3)
|
|
108
|
+
activesupport (>= 4.2.0)
|
|
109
|
+
nokogiri (>= 1.6)
|
|
110
|
+
rails-html-sanitizer (1.3.0)
|
|
111
|
+
loofah (~> 2.3)
|
|
109
112
|
railties (5.0.2)
|
|
110
113
|
actionpack (= 5.0.2)
|
|
111
114
|
activesupport (= 5.0.2)
|
|
112
115
|
method_source
|
|
113
116
|
rake (>= 0.8.7)
|
|
114
117
|
thor (>= 0.18.1, < 2.0)
|
|
115
|
-
rake (
|
|
118
|
+
rake (13.0.0)
|
|
116
119
|
rb-fsevent (0.9.8)
|
|
117
120
|
rb-inotify (0.9.8)
|
|
118
121
|
ffi (>= 0.5.0)
|
|
119
|
-
responders (
|
|
120
|
-
|
|
122
|
+
responders (3.0.0)
|
|
123
|
+
actionpack (>= 5.0)
|
|
124
|
+
railties (>= 5.0)
|
|
121
125
|
sass (3.4.23)
|
|
122
126
|
sass-rails (5.0.6)
|
|
123
127
|
railties (>= 4.0.0, < 6)
|
|
@@ -130,7 +134,7 @@ GEM
|
|
|
130
134
|
spring-watcher-listen (2.0.1)
|
|
131
135
|
listen (>= 2.7, < 4.0)
|
|
132
136
|
spring (>= 1.2, < 3.0)
|
|
133
|
-
sprockets (3.7.
|
|
137
|
+
sprockets (3.7.2)
|
|
134
138
|
concurrent-ruby (~> 1.0)
|
|
135
139
|
rack (> 1, < 3)
|
|
136
140
|
sprockets-rails (3.2.0)
|
|
@@ -138,18 +142,18 @@ GEM
|
|
|
138
142
|
activesupport (>= 4.0)
|
|
139
143
|
sprockets (>= 3.0.0)
|
|
140
144
|
sqlite3 (1.3.13)
|
|
141
|
-
thor (0.
|
|
145
|
+
thor (0.20.3)
|
|
142
146
|
thread_safe (0.3.6)
|
|
143
147
|
tilt (2.0.6)
|
|
144
148
|
turbolinks (5.0.1)
|
|
145
149
|
turbolinks-source (~> 5)
|
|
146
150
|
turbolinks-source (5.0.0)
|
|
147
|
-
tzinfo (1.2.
|
|
151
|
+
tzinfo (1.2.5)
|
|
148
152
|
thread_safe (~> 0.1)
|
|
149
153
|
uglifier (3.1.4)
|
|
150
154
|
execjs (>= 0.3.0, < 3)
|
|
151
|
-
warden (1.2.
|
|
152
|
-
rack (>=
|
|
155
|
+
warden (1.2.8)
|
|
156
|
+
rack (>= 2.0.6)
|
|
153
157
|
web-console (3.4.0)
|
|
154
158
|
actionview (>= 5.0)
|
|
155
159
|
activemodel (>= 5.0)
|
|
@@ -30,7 +30,7 @@ class DeviseCreateUsers < ActiveRecord::Migration[5.0]
|
|
|
30
30
|
add_index :users, :reset_password_token, unique: true
|
|
31
31
|
# add_index :users, :unlock_token, unique: true
|
|
32
32
|
|
|
33
|
-
create_table :
|
|
33
|
+
create_table :user_emails do |t|
|
|
34
34
|
t.integer :user_id, null: false
|
|
35
35
|
t.string :email, null: false
|
|
36
36
|
t.string :unconfirmed_email
|
|
@@ -44,6 +44,6 @@ class DeviseCreateUsers < ActiveRecord::Migration[5.0]
|
|
|
44
44
|
t.timestamps null: false
|
|
45
45
|
end
|
|
46
46
|
|
|
47
|
-
add_index :
|
|
47
|
+
add_index :user_emails, :confirmation_token, unique: true
|
|
48
48
|
end
|
|
49
49
|
end
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
|
|
13
13
|
ActiveRecord::Schema.define(version: 20170307145547) do
|
|
14
14
|
|
|
15
|
-
create_table "
|
|
15
|
+
create_table "user_emails", force: :cascade do |t|
|
|
16
16
|
t.integer "user_id", null: false
|
|
17
17
|
t.string "email", null: false
|
|
18
18
|
t.string "unconfirmed_email"
|
data/gemfiles/rails_5_0.gemfile
CHANGED
|
@@ -42,13 +42,13 @@ module Devise
|
|
|
42
42
|
|
|
43
43
|
# delegate before creating overriding methods
|
|
44
44
|
delegate :skip_confirmation!, :skip_confirmation_notification!, :skip_reconfirmation!, :confirmation_required?,
|
|
45
|
-
:confirmation_token, :confirmed_at, :confirmation_sent_at, :confirm, :confirmed?, :unconfirmed_email,
|
|
46
|
-
:reconfirmation_required?, :pending_reconfirmation?, to:
|
|
45
|
+
:confirmation_token, :confirmed_at, :confirmed_at=, :confirmation_sent_at, :confirm, :confirmed?, :unconfirmed_email,
|
|
46
|
+
:reconfirmation_required?, :pending_reconfirmation?, to: Devise::MultiEmail.primary_email_method_name, allow_nil: true
|
|
47
47
|
|
|
48
48
|
# In case email updates are being postponed, don't change anything
|
|
49
49
|
# when the postpone feature tries to switch things back
|
|
50
50
|
def email=(new_email)
|
|
51
|
-
multi_email.change_primary_email_to(new_email, allow_unconfirmed:
|
|
51
|
+
multi_email.change_primary_email_to(new_email, allow_unconfirmed: Devise.allow_unconfirmed_access_for > 0.days)
|
|
52
52
|
end
|
|
53
53
|
|
|
54
54
|
# This need to be forwarded to the email that the user logged in with
|
|
@@ -7,8 +7,13 @@ module Devise
|
|
|
7
7
|
|
|
8
8
|
included do
|
|
9
9
|
validates_presence_of :email, if: :email_required?
|
|
10
|
-
|
|
11
|
-
|
|
10
|
+
if Devise.activerecord51?
|
|
11
|
+
validates_uniqueness_of :email, allow_blank: true, case_sensitive: true, if: :will_save_change_to_email?
|
|
12
|
+
validates_format_of :email, with: email_regexp, allow_blank: true, if: :will_save_change_to_email?
|
|
13
|
+
else
|
|
14
|
+
validates_uniqueness_of :email, allow_blank: true, if: :email_changed?
|
|
15
|
+
validates_format_of :email, with: email_regexp, allow_blank: true, if: :email_changed?
|
|
16
|
+
end
|
|
12
17
|
end
|
|
13
18
|
|
|
14
19
|
def email_required?
|
|
@@ -60,12 +65,24 @@ module Devise
|
|
|
60
65
|
private
|
|
61
66
|
|
|
62
67
|
def propagate_email_errors
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
68
|
+
association_name = self.class.multi_email_association.name
|
|
69
|
+
email_error_key = errors.keys.detect do |key|
|
|
70
|
+
[association_name.to_s, "#{association_name}.email"].include?(key.to_s)
|
|
71
|
+
end
|
|
72
|
+
return unless email_error_key.present?
|
|
73
|
+
|
|
74
|
+
email_errors =
|
|
75
|
+
if errors.respond_to?(:details)
|
|
76
|
+
errors
|
|
77
|
+
.details[email_error_key]
|
|
78
|
+
.map { |e| e[:error] }
|
|
79
|
+
.zip(errors.delete(email_error_key) || [])
|
|
80
|
+
else
|
|
81
|
+
errors.delete(email_error_key)
|
|
82
|
+
end
|
|
66
83
|
|
|
67
|
-
email_errors.each do |
|
|
68
|
-
errors.add(:email,
|
|
84
|
+
email_errors.each do |type, message|
|
|
85
|
+
errors.add(:email, type, message: message)
|
|
69
86
|
end
|
|
70
87
|
end
|
|
71
88
|
|
|
@@ -62,7 +62,7 @@ module Devise
|
|
|
62
62
|
|
|
63
63
|
# Gets the email records that have not been deleted
|
|
64
64
|
def filtered_emails(options = {})
|
|
65
|
-
emails.
|
|
65
|
+
emails.to_a.reject(&:destroyed?).reject(&:marked_for_destruction?)
|
|
66
66
|
end
|
|
67
67
|
|
|
68
68
|
def confirmed_emails
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: devise-multi_email
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version:
|
|
4
|
+
version: 3.0.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- ALLEN WANG QIANG
|
|
@@ -9,7 +9,7 @@ authors:
|
|
|
9
9
|
autorequire:
|
|
10
10
|
bindir: exe
|
|
11
11
|
cert_chain: []
|
|
12
|
-
date:
|
|
12
|
+
date: 2019-11-06 00:00:00.000000000 Z
|
|
13
13
|
dependencies:
|
|
14
14
|
- !ruby/object:Gem::Dependency
|
|
15
15
|
name: devise
|
|
@@ -29,16 +29,16 @@ dependencies:
|
|
|
29
29
|
name: bundler
|
|
30
30
|
requirement: !ruby/object:Gem::Requirement
|
|
31
31
|
requirements:
|
|
32
|
-
- - "
|
|
32
|
+
- - ">="
|
|
33
33
|
- !ruby/object:Gem::Version
|
|
34
|
-
version: '
|
|
34
|
+
version: '0'
|
|
35
35
|
type: :development
|
|
36
36
|
prerelease: false
|
|
37
37
|
version_requirements: !ruby/object:Gem::Requirement
|
|
38
38
|
requirements:
|
|
39
|
-
- - "
|
|
39
|
+
- - ">="
|
|
40
40
|
- !ruby/object:Gem::Version
|
|
41
|
-
version: '
|
|
41
|
+
version: '0'
|
|
42
42
|
- !ruby/object:Gem::Dependency
|
|
43
43
|
name: rake
|
|
44
44
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -119,7 +119,6 @@ extra_rdoc_files: []
|
|
|
119
119
|
files:
|
|
120
120
|
- ".gitignore"
|
|
121
121
|
- ".rspec"
|
|
122
|
-
- ".simplecov"
|
|
123
122
|
- ".travis.yml"
|
|
124
123
|
- CHANGELOG.md
|
|
125
124
|
- CODE_OF_CONDUCT.md
|
|
@@ -214,6 +213,7 @@ files:
|
|
|
214
213
|
- gemfiles/rails_4_2.gemfile
|
|
215
214
|
- gemfiles/rails_5_0.gemfile
|
|
216
215
|
- gemfiles/rails_5_1.gemfile
|
|
216
|
+
- gemfiles/rails_5_2.gemfile
|
|
217
217
|
- lib/devise/multi_email.rb
|
|
218
218
|
- lib/devise/multi_email/association_manager.rb
|
|
219
219
|
- lib/devise/multi_email/email_model_extensions.rb
|
|
@@ -244,7 +244,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
244
244
|
version: '0'
|
|
245
245
|
requirements: []
|
|
246
246
|
rubyforge_project:
|
|
247
|
-
rubygems_version: 2.
|
|
247
|
+
rubygems_version: 2.7.9
|
|
248
248
|
signing_key:
|
|
249
249
|
specification_version: 4
|
|
250
250
|
summary: Let devise support multiple emails.
|