valid_email2 3.0.0 → 3.0.1
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 +4 -4
- data/CHANGELOG.md +4 -0
- data/README.md +1 -0
- data/lib/valid_email2/address.rb +5 -5
- data/lib/valid_email2/version.rb +1 -1
- data/spec/valid_email2_spec.rb +5 -5
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7a2cf0205525e8abee7c2bdc06389a0c49e63407bbb863f44eff7d0e7018dde1
|
4
|
+
data.tar.gz: 8a3459e1bce845359ebd651666c354935d58fcad9f71fdfcb4e6fbeca32e7e2c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 92029d3f7c4f7ed447c033f60ff4e372186386d5876746fd994761a7b332e143e0a198e2e87c223a1465c43448dfe4871137e3b6d03d55bc846f6abf0ff25796
|
7
|
+
data.tar.gz: 7cffa1a1628d3a9f2fc0dd1fa2b809c6fc111efaf3fdfe1e75b003a1df973e3f7ebaf66c626740f7387cf78c857a2e7c614ae913165d8e0964df4f43e1c850c5
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,7 @@
|
|
1
|
+
## Version 3.0.1
|
2
|
+
Relax the restrictions on domain validation so that we allow unicode domains and
|
3
|
+
other non ASCII domains while still disallowing the domains we blocked before.
|
4
|
+
|
1
5
|
## Version 3.0.0
|
2
6
|
* Moved __and__ renamed blacklist and whitelist and disposable_emails. Moved from the vendor directory to
|
3
7
|
the config directory.
|
data/README.md
CHANGED
@@ -114,6 +114,7 @@ This gem requires Rails 3.2 or 4.0 or higher. It is tested against both versions
|
|
114
114
|
|
115
115
|
In version v3.0.0 I decided to move __and__ rename the config files from the
|
116
116
|
vendor directory to the config directory. That means:
|
117
|
+
|
117
118
|
`vendor/blacklist.yml` -> `config/blacklisted_email_domains.yml`
|
118
119
|
`vendor/whitelist.yml` -> `config/whitelisted_email_domains.yml`
|
119
120
|
|
data/lib/valid_email2/address.rb
CHANGED
@@ -6,7 +6,7 @@ module ValidEmail2
|
|
6
6
|
class Address
|
7
7
|
attr_accessor :address
|
8
8
|
|
9
|
-
|
9
|
+
PROHIBITED_DOMAIN_CHARACTERS_REGEX = /[+!_]/
|
10
10
|
DEFAULT_RECIPIENT_DELIMITER = '+'.freeze
|
11
11
|
|
12
12
|
def initialize(address)
|
@@ -28,13 +28,13 @@ module ValidEmail2
|
|
28
28
|
if address.domain && address.address == @raw_address
|
29
29
|
domain = address.domain
|
30
30
|
|
31
|
-
domain
|
31
|
+
domain !~ PROHIBITED_DOMAIN_CHARACTERS_REGEX &&
|
32
32
|
# Domain needs to have at least one dot
|
33
|
-
domain
|
33
|
+
domain =~ /\./ &&
|
34
34
|
# Domain may not have two consecutive dots
|
35
|
-
|
35
|
+
domain !~ /\.{2,}/ &&
|
36
36
|
# Domain may not start with a dot
|
37
|
-
|
37
|
+
domain !~ /^\./
|
38
38
|
else
|
39
39
|
false
|
40
40
|
end
|
data/lib/valid_email2/version.rb
CHANGED
data/spec/valid_email2_spec.rb
CHANGED
@@ -147,17 +147,17 @@ describe ValidEmail2 do
|
|
147
147
|
end
|
148
148
|
|
149
149
|
describe "with mx validation" do
|
150
|
-
it "
|
150
|
+
it "is valid if mx records are found" do
|
151
151
|
user = TestUserMX.new(email: "foo@gmail.com")
|
152
152
|
expect(user.valid?).to be_truthy
|
153
153
|
end
|
154
154
|
|
155
|
-
it "
|
155
|
+
it "is valid if A records are found" do
|
156
156
|
user = TestUserMX.new(email: "foo@ghs.google.com")
|
157
157
|
expect(user.valid?).to be_truthy
|
158
158
|
end
|
159
159
|
|
160
|
-
it "
|
160
|
+
it "is invalid if no mx records are found" do
|
161
161
|
user = TestUserMX.new(email: "foo@subdomain.gmail.com")
|
162
162
|
expect(user.valid?).to be_falsey
|
163
163
|
end
|
@@ -184,12 +184,12 @@ describe ValidEmail2 do
|
|
184
184
|
end
|
185
185
|
|
186
186
|
describe "#subaddressed?" do
|
187
|
-
it "
|
187
|
+
it "is true when address local part contains a recipient delimiter ('+')" do
|
188
188
|
email = ValidEmail2::Address.new("foo+1@gmail.com")
|
189
189
|
expect(email.subaddressed?).to be_truthy
|
190
190
|
end
|
191
191
|
|
192
|
-
it "
|
192
|
+
it "is false when address local part contains a recipient delimiter ('+')" do
|
193
193
|
email = ValidEmail2::Address.new("foo@gmail.com")
|
194
194
|
expect(email.subaddressed?).to be_falsey
|
195
195
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: valid_email2
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.0.
|
4
|
+
version: 3.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Micke Lisinge
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-02-
|
11
|
+
date: 2019-02-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|