valid_email2 3.0.0 → 3.0.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: '0296f4789b78afcfabaa2f6815dbcb00d31f791e68b6f555f0d59dc3e7d2c458'
4
- data.tar.gz: ea0e4c44adbec83fe1aae8e600e4e2730852007d53e1aac7b5f1482fc04f674d
3
+ metadata.gz: 7a2cf0205525e8abee7c2bdc06389a0c49e63407bbb863f44eff7d0e7018dde1
4
+ data.tar.gz: 8a3459e1bce845359ebd651666c354935d58fcad9f71fdfcb4e6fbeca32e7e2c
5
5
  SHA512:
6
- metadata.gz: 37b74fe00a659b7db36020e1acd7e403721df1e8dc12250c1224b98e23b30768caa41584538be75006dfa83c8d16cea86ac44a6fd4a5281d1d722feb4fc8e65b
7
- data.tar.gz: bf89335f3cd8f28a7b8367989dc6aa36dd85555c064d3eb9f066a657871c1e32c6a0eed30da7d625b39027b2ff485f71c20806ed9f1983ebd9556adbf7d2b564
6
+ metadata.gz: 92029d3f7c4f7ed447c033f60ff4e372186386d5876746fd994761a7b332e143e0a198e2e87c223a1465c43448dfe4871137e3b6d03d55bc846f6abf0ff25796
7
+ data.tar.gz: 7cffa1a1628d3a9f2fc0dd1fa2b809c6fc111efaf3fdfe1e75b003a1df973e3f7ebaf66c626740f7387cf78c857a2e7c614ae913165d8e0964df4f43e1c850c5
@@ -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
 
@@ -6,7 +6,7 @@ module ValidEmail2
6
6
  class Address
7
7
  attr_accessor :address
8
8
 
9
- ALLOWED_DOMAIN_CHARACTERS_REGEX = /\A[a-z0-9\-.]+\z/i
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.match(ALLOWED_DOMAIN_CHARACTERS_REGEX) &&
31
+ domain !~ PROHIBITED_DOMAIN_CHARACTERS_REGEX &&
32
32
  # Domain needs to have at least one dot
33
- domain.match(/\./) &&
33
+ domain =~ /\./ &&
34
34
  # Domain may not have two consecutive dots
35
- !domain.match(/\.{2,}/) &&
35
+ domain !~ /\.{2,}/ &&
36
36
  # Domain may not start with a dot
37
- !domain.match(/^\./)
37
+ domain !~ /^\./
38
38
  else
39
39
  false
40
40
  end
@@ -1,3 +1,3 @@
1
1
  module ValidEmail2
2
- VERSION = "3.0.0"
2
+ VERSION = "3.0.1"
3
3
  end
@@ -147,17 +147,17 @@ describe ValidEmail2 do
147
147
  end
148
148
 
149
149
  describe "with mx validation" do
150
- it "should be valid if mx records are found" do
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 "should be valid if A records are found" do
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 "should be invalid if no mx records are found" do
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 "should be true when address local part contains a recipient delimiter ('+')" do
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 "should be false when address local part contains a recipient delimiter ('+')" do
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.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-02 00:00:00.000000000 Z
11
+ date: 2019-02-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler