valid_email 0.0.13 → 0.1.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: ca6b2a7baefd0f49bd9f7bceb9bdcc809164fd2b
4
- data.tar.gz: 0a66612b626c0e168b2f18e419cf8ca42c554370
3
+ metadata.gz: e74f85e1ed674767b2c063685a30bb2ebbc6e9fe
4
+ data.tar.gz: fe2254848da959f25c12732890ba4acd020c618d
5
5
  SHA512:
6
- metadata.gz: e462c60e4c9e72b373a6a17132b29c17d08589c40f32a261690395aae79dafb96072ad40b4b30904632498906a6003ee1acb0ce75417f019e5d4541333d24bc1
7
- data.tar.gz: fcb9dc08ef5995b1b2c69b55b4224001f47ba09995adf206a3c1a53fad0e25ebf501b3923754f04ec97d5e0a636a3011dde80ae45275bd2d2a89bd216881ada8
6
+ metadata.gz: c5b07afeee1c98a219e66d40358e46a898939951cfeb6f5aef6d2bd6f76b77f62e3da37442d614746905c54b0a6acee5cf5f4c1ae3fa67a18f2607b1d2d95493
7
+ data.tar.gz: db5b162817ff28baee70881951062943363808f7f519954d15e91a0eb66207839249b84f8f0b819396e4a22c16de18081a4e209d9d8e4d42126559a5fde3f924
@@ -5,4 +5,9 @@ rvm:
5
5
  - 1.9.3
6
6
  - 2.0.0
7
7
  - 2.1
8
+ - 2.2.1
9
+ - 2.2.2
10
+ - 2.3.3
11
+ - 2.4.0
8
12
  - jruby-19mode
13
+ - jruby-20mode
@@ -0,0 +1,11 @@
1
+
2
+ 0.1.0 / 2017-09-27
3
+ ==================
4
+
5
+ * #86 Change dependency on mail to >= 2.6.1
6
+ * #85 adding disposable email domains from getnada
7
+ * #84 ValidateEmail.valid?: make domain validation true by default
8
+ * #83 Allow to configure timeouts for dns
9
+ * #82 Travis CI. Support for more Ruby versions
10
+ * #80 rescue Mail::Field::ParseError also in domain_valid?
11
+ * #78 Added pt-BR translation
data/README.md CHANGED
@@ -40,12 +40,11 @@ Or
40
40
 
41
41
  validates :email, :email => {:message => I18n.t('validations.errors.models.user.invalid_email')}, :mx => {:message => I18n.t('validations.errors.models.user.invalid_mx')}
42
42
 
43
- You can check if the email domain looks valid. This uses a regular expression so no external services are required, which improves the performance of this check:
44
-
45
- validates :email, :email => {:domain => true}
46
-
43
+ By default, the email domain is validated using a regular expression, which does not require an external service and improves performance.
47
44
  Alternatively, you can check if an email domain has a MX or A record by using `:mx_with_fallback` instead of `:mx`.
48
45
 
46
+ validates :email, :email => {:mx_with_fallback => true}
47
+
49
48
  You can detect disposable accounts
50
49
 
51
50
  validates :email, :email => {:ban_disposable_email => true, :message => I18n.t('validations.errors.models.user.invalid_email')}
@@ -0,0 +1,5 @@
1
+ pt-BR:
2
+ valid_email:
3
+ validations:
4
+ email:
5
+ invalid: "é inválido"
@@ -1,16 +1,4 @@
1
1
  disposable_email_services:
2
- - mailinator.com
3
- - devnullmail.com
4
- - daddymail.biz
5
- - grr.la
6
- - drdrb.net
7
- - getairmail.com
8
- - evopo.com
9
- - 6paq.com
10
- - paplease.com
11
- - acentri.com
12
- - droplar.com
13
- - appixie.com
14
2
  - 0-mail.com
15
3
  - 0815.ru
16
4
  - 0clickemail.com
@@ -29,21 +17,18 @@ disposable_email_services:
29
17
  - 675hosting.com
30
18
  - 675hosting.net
31
19
  - 675hosting.org
20
+ - 6paq.com
32
21
  - 6url.com
33
22
  - 75hosting.com
34
23
  - 75hosting.net
35
24
  - 75hosting.org
36
25
  - 7tags.com
37
26
  - 9ox.net
38
- - disposableemailaddresses.com
39
- - putthisinyourspamdatabase.com
40
- - sendspamhere.com
41
- - spamherelots.com
42
- - spamhereplease.com
43
- - tempemail.net
44
27
  - a-bc.net
28
+ - acentri.com
45
29
  - afrobacon.com
46
30
  - ajaxapp.net
31
+ - amail.club
47
32
  - amail4.me
48
33
  - amilegit.com
49
34
  - amiri.net
@@ -53,8 +38,11 @@ disposable_email_services:
53
38
  - antichef.com
54
39
  - antichef.net
55
40
  - antispam.de
41
+ - appixie.com
56
42
  - armyspy.com
57
43
  - azmeil.tk
44
+ - banit.club
45
+ - banit.me
58
46
  - baxomale.ht.cx
59
47
  - beefmilk.com
60
48
  - binkmail.com
@@ -69,11 +57,13 @@ disposable_email_services:
69
57
  - bsnow.net
70
58
  - bugmenot.com
71
59
  - bumpymail.com
60
+ - cars2.club
72
61
  - casualdx.com
73
62
  - centermail.com
74
63
  - centermail.net
75
64
  - chogmail.com
76
65
  - choicemail1.com
66
+ - cmail.club
77
67
  - cool.fr.nf
78
68
  - correo.blogos.net
79
69
  - cosmorph.com
@@ -84,6 +74,7 @@ disposable_email_services:
84
74
  - cust.in
85
75
  - cuvox.de
86
76
  - dacoolest.com
77
+ - daddymail.biz
87
78
  - dandikmail.com
88
79
  - dayrep.com
89
80
  - deadaddress.com
@@ -96,6 +87,7 @@ disposable_email_services:
96
87
  - discardmail.com
97
88
  - discardmail.de
98
89
  - disposableaddress.com
90
+ - disposableemailaddresses.com
99
91
  - disposeamail.com
100
92
  - disposemail.com
101
93
  - dispostable.com
@@ -107,6 +99,9 @@ disposable_email_services:
107
99
  - dontreg.com
108
100
  - dontsendmespam.de
109
101
  - drdrb.com
102
+ - drdrb.net
103
+ - droplar.com
104
+ - duck2.club
110
105
  - dump-email.info
111
106
  - dumpandjunk.com
112
107
  - dumpmail.de
@@ -133,6 +128,7 @@ disposable_email_services:
133
128
  - etranquil.com
134
129
  - etranquil.net
135
130
  - etranquil.org
131
+ - evopo.com
136
132
  - explodemail.com
137
133
  - fakeinbox.com
138
134
  - fakeinformation.com
@@ -158,6 +154,7 @@ disposable_email_services:
158
154
  - get1mail.com
159
155
  - get2mail.fr
160
156
  - getairmail.com
157
+ - getnada.com
161
158
  - getonemail.com
162
159
  - getonemail.net
163
160
  - ghosttexter.de
@@ -174,6 +171,7 @@ disposable_email_services:
174
171
  - gowikitv.com
175
172
  - great-host.in
176
173
  - greensloth.com
174
+ - grr.la
177
175
  - gsrv.co.uk
178
176
  - guerillamail.biz
179
177
  - guerillamail.com
@@ -299,6 +297,8 @@ disposable_email_services:
299
297
  - myspacepimpedup.com
300
298
  - myspamless.com
301
299
  - mytrashmail.com
300
+ - nada.email
301
+ - nada.ltd
302
302
  - neomailbox.com
303
303
  - nepwk.com
304
304
  - nervmich.net
@@ -336,6 +336,7 @@ disposable_email_services:
336
336
  - ovpn.to
337
337
  - owlpic.com
338
338
  - pancakemail.com
339
+ - paplease.com
339
340
  - pimpedupmyspace.com
340
341
  - pjjkp.com
341
342
  - politikerclub.de
@@ -345,6 +346,7 @@ disposable_email_services:
345
346
  - proxymail.eu
346
347
  - prtnx.com
347
348
  - punkass.com
349
+ - putthisinyourspamdatabase.com
348
350
  - qq.com
349
351
  - quickinbox.com
350
352
  - rcpt.at
@@ -366,6 +368,7 @@ disposable_email_services:
366
368
  - sandelf.de
367
369
  - saynotospams.com
368
370
  - selfdestructingmail.com
371
+ - sendspamhere.com
369
372
  - sharklasers.com
370
373
  - shiftmail.com
371
374
  - shitmail.me
@@ -413,6 +416,8 @@ disposable_email_services:
413
416
  - spamgourmet.com
414
417
  - spamgourmet.net
415
418
  - spamgourmet.org
419
+ - spamherelots.com
420
+ - spamhereplease.com
416
421
  - spamhole.com
417
422
  - spamify.com
418
423
  - spaminator.de
@@ -440,6 +445,7 @@ disposable_email_services:
440
445
  - tempe-mail.com
441
446
  - tempemail.biz
442
447
  - tempemail.com
448
+ - tempemail.net
443
449
  - tempinbox.co.uk
444
450
  - tempinbox.com
445
451
  - tempmail.it
@@ -500,6 +506,7 @@ disposable_email_services:
500
506
  - whyspam.me
501
507
  - willselfdestruct.com
502
508
  - winemaven.info
509
+ - wmail.club
503
510
  - wronghead.com
504
511
  - wuzup.net
505
512
  - wuzupmail.net
@@ -3,6 +3,12 @@ require 'active_model/validations'
3
3
  require 'resolv'
4
4
  require 'valid_email/validate_email'
5
5
  class MxValidator < ActiveModel::EachValidator
6
+ def self.config
7
+ @@config = { timeouts: [] } unless defined? @@config
8
+
9
+ @@config
10
+ end
11
+
6
12
  def validate_each(record,attribute,value)
7
13
  r = ValidateEmail.mx_valid?(value)
8
14
  record.errors.add attribute, (options[:message] || I18n.t(:invalid, :scope => "valid_email.validations.email")) unless r
@@ -10,7 +10,7 @@ class ValidateEmail
10
10
  def valid?(value, user_options={})
11
11
  options = {
12
12
  :mx => false,
13
- :domain => false,
13
+ :domain => true,
14
14
  :message => nil
15
15
  }.merge(user_options)
16
16
 
@@ -92,6 +92,7 @@ class ValidateEmail
92
92
 
93
93
  mx = []
94
94
  Resolv::DNS.open do |dns|
95
+ dns.timeouts = MxValidator.config[:timeouts] unless MxValidator.config[:timeouts].empty?
95
96
  mx.concat dns.getresources(m.domain, Resolv::DNS::Resource::IN::MX)
96
97
  mx.concat dns.getresources(m.domain, Resolv::DNS::Resource::IN::A) if fallback
97
98
  end
@@ -110,6 +111,9 @@ class ValidateEmail
110
111
  return false unless m.domain
111
112
 
112
113
  !(m.domain =~ DOMAIN_REGEX).nil?
114
+
115
+ rescue Mail::Field::ParseError
116
+ false
113
117
  end
114
118
 
115
119
  def ban_disposable_email?(value)
@@ -1 +1 @@
1
- ValidEmailVersion = "0.0.13"
1
+ ValidEmailVersion = "0.1.0"
@@ -100,6 +100,18 @@ describe EmailValidator do
100
100
  expect(subject.errors[:email]).to eq errors
101
101
  end
102
102
 
103
+ it "fails when email ends with a period" do
104
+ subject.email = 'john@doe.com.'
105
+ expect(subject.valid?).to be_falsey
106
+ expect(subject.errors[:email]).to eq errors
107
+ end
108
+
109
+ it "fails when email ends with special characters" do
110
+ subject.email = 'john@doe.com&'
111
+ expect(subject.valid?).to be_falsey
112
+ expect(subject.errors[:email]).to eq errors
113
+ end
114
+
103
115
  it "fails when email is valid with information" do
104
116
  subject.email = '"John Doe" <john@doe.com>'
105
117
  expect(subject.valid?).to be_falsey
@@ -64,6 +64,7 @@ describe ValidateEmail do
64
64
  'test..com',
65
65
  'test@test.com',
66
66
  "example.org$\'",
67
+ "foo bar.com",
67
68
  ]
68
69
 
69
70
  invalid_domains.each do |invalid_domain|
@@ -21,7 +21,14 @@ Gem::Specification.new do |s|
21
21
 
22
22
  # specify any dependencies here; for example:
23
23
  s.add_development_dependency "rspec", "~> 2.99"
24
- s.add_development_dependency "rake"
25
- s.add_runtime_dependency "mail", "~> 2.6.1"
26
- s.add_runtime_dependency "activemodel"
24
+ s.add_development_dependency "rake", '< 11.0'
25
+ s.add_runtime_dependency "mail", ">= 2.6.1"
26
+ if Gem::Version.new(RUBY_VERSION) <= Gem::Version.new('2.0')
27
+ s.add_runtime_dependency 'mime-types', '<= 2.6.2'
28
+ end
29
+ if Gem::Version.new(RUBY_VERSION) < Gem::Version.new('2.2.2')
30
+ s.add_runtime_dependency "activemodel", '< 5.0.0'
31
+ else
32
+ s.add_runtime_dependency "activemodel"
33
+ end
27
34
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: valid_email
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.13
4
+ version: 0.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ramihajamalala Hery
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-03-11 00:00:00.000000000 Z
11
+ date: 2017-09-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rspec
@@ -28,28 +28,28 @@ dependencies:
28
28
  name: rake
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - ">="
31
+ - - "<"
32
32
  - !ruby/object:Gem::Version
33
- version: '0'
33
+ version: '11.0'
34
34
  type: :development
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - ">="
38
+ - - "<"
39
39
  - !ruby/object:Gem::Version
40
- version: '0'
40
+ version: '11.0'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: mail
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - "~>"
45
+ - - ">="
46
46
  - !ruby/object:Gem::Version
47
47
  version: 2.6.1
48
48
  type: :runtime
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - "~>"
52
+ - - ">="
53
53
  - !ruby/object:Gem::Version
54
54
  version: 2.6.1
55
55
  - !ruby/object:Gem::Dependency
@@ -76,6 +76,7 @@ files:
76
76
  - ".gitignore"
77
77
  - ".travis.yml"
78
78
  - Gemfile
79
+ - History.md
79
80
  - LICENSE
80
81
  - README.md
81
82
  - Rakefile
@@ -87,6 +88,7 @@ files:
87
88
  - config/locales/id.yml
88
89
  - config/locales/ja.yml
89
90
  - config/locales/pl.yml
91
+ - config/locales/pt-BR.yml
90
92
  - config/locales/ru.yml
91
93
  - config/locales/sv.yml
92
94
  - config/locales/uk.yml
@@ -126,7 +128,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
126
128
  version: '0'
127
129
  requirements: []
128
130
  rubyforge_project: valid_email
129
- rubygems_version: 2.4.5.1
131
+ rubygems_version: 2.6.10
130
132
  signing_key:
131
133
  specification_version: 4
132
134
  summary: ActiveModel Validation for email