mailshield 1.3 → 1.5

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
  SHA256:
3
- metadata.gz: 362dd7a7c8a948582fdffea7fdc081da39461f3711e247a2cd79afa88d6635c8
4
- data.tar.gz: 151d0b56d0f2bcbfacab22f427b2bc9712b543b4c6f49c72c9f634b0100f693b
3
+ metadata.gz: a7a2c56984d3291c6834cb7ec0dd5b8ad1217853be110281863a0aa8fe47c0ce
4
+ data.tar.gz: 2b36df2860cbf4bc9b4374541cd3b0a73706c1096a87e053131e77e03ba7f3d3
5
5
  SHA512:
6
- metadata.gz: 9b29470d6e8d15577c201fa8b2a02220f71c6d96c69e6de7700f72c3fc3f8831a592d2422ee3b7c6bb696b882d465f4cafcf679bbac0f001a6d881fb97b03b06
7
- data.tar.gz: 5a341e947ab69d9b202f426a8ed2ee1646350ee945f597a87d72be72e76cd2e5ec42c1db0a7d2248fe88b3ed890796aa046aecfdc2d43bc77ed0ba5ccb928501
6
+ metadata.gz: 1ce12f3f8a8496c9d8e548a2f5195c00c4ffeaec64648a9ece07744d9825681224317f7e5cdf0fb02679eeca449ae3437024576f470da32ce1ba661be469bf37
7
+ data.tar.gz: cb1560e4f84081e7e23788ec48f0453bef2f7435336fc51d569def04c38798f997f7815ab13396fb653573934098405752d330b623504e8114555f63d9bf6a93
@@ -1,6 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
  require 'set'
3
3
 
4
+
4
5
  module MailShield
5
6
  KNOWN_DISPOSABLE_DOMAINS = Set.new(
6
7
  [
@@ -85,10 +86,9 @@ module MailShield
85
86
  ]
86
87
  )
87
88
 
88
-
89
89
  class << self
90
- def validate_known_disposal_domain?(domain)
91
- raise TemporaryDomainError, 'Temporary / Disposal Email.' if KNOWN_DISPOSABLE_DOMAINS.include?(domain)
90
+ def validate_known_disposal_domain?(domain)
91
+ raise TemporaryDomainError, 'Temporary / Disposal Email.' if KNOWN_DISPOSABLE_DOMAINS.include?(domain)
92
92
  end
93
93
  end
94
- end
94
+ end
@@ -12,7 +12,7 @@ module MailShield
12
12
 
13
13
  return if result[:valid]
14
14
 
15
- record.errors.add(:email, result[:issue])
15
+ record.errors.add(:base, result[:reason])
16
16
  end
17
17
  end
18
18
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Mailshield
4
- VERSION = '1.3'
5
- end
4
+ VERSION = '1.5'
5
+ end
data/lib/mailshield.rb CHANGED
@@ -2,6 +2,7 @@
2
2
 
3
3
  require_relative 'mailshield/version'
4
4
  require_relative 'mailshield/disposable_domains'
5
+ require 'mailshield/secure_email_validator'
5
6
  require 'resolv'
6
7
  require 'csv'
7
8
  require 'net/smtp'
@@ -19,7 +20,7 @@ module MailShield
19
20
  class << self
20
21
  attr_accessor :dns_cache, :smtp_cache
21
22
 
22
- def validate_email(email, verify_by_send: false)
23
+ def validate_email(email)
23
24
  reset_caches
24
25
 
25
26
  domain = extract_domain(email)
@@ -30,8 +31,7 @@ module MailShield
30
31
  validate_domain!(domain)
31
32
  validate_spf!(domain)
32
33
  validate_dmarc!(domain)
33
- validate_smtp!(email) if verify_by_send
34
-
34
+ validate_smtp!(email)
35
35
  rescue ValidationError => e
36
36
  return { valid: false, reason: e.message }
37
37
  end
@@ -39,7 +39,7 @@ module MailShield
39
39
  { valid: true }
40
40
  end
41
41
 
42
- def verify_address(email)
42
+ def email_exists?(email)
43
43
  smtp_verify_email(email)
44
44
  end
45
45
 
@@ -129,3 +129,13 @@ module MailShield
129
129
  end
130
130
  end
131
131
  end
132
+
133
+ module ActiveModel
134
+ module Validations
135
+ class SecureEmailValidator < ::MailShield::SecureEmailValidator
136
+ def initialize(options = {})
137
+ super
138
+ end
139
+ end
140
+ end
141
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mailshield
3
3
  version: !ruby/object:Gem::Version
4
- version: '1.3'
4
+ version: '1.5'
5
5
  platform: ruby
6
6
  authors:
7
7
  - jana
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-09-03 00:00:00.000000000 Z
11
+ date: 2024-09-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: net-smtp
@@ -63,5 +63,6 @@ requirements: []
63
63
  rubygems_version: 3.5.18
64
64
  signing_key:
65
65
  specification_version: 4
66
- summary: A gem to detect temporary or disposable email domains.
66
+ summary: MailShield enhances your app’s security by blocking temporary, spam and disposable
67
+ email addresses, keeping your user data clean and reducing spam.
67
68
  test_files: []