validators 3.0.4 → 3.0.5

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: 4e738147d0ba1ba1f88440327c3528d8a97249e5984228ad4c4012009fb8f2e6
4
- data.tar.gz: fca6a593a2ee31cba5904dd120af17c4586c470c7d90923499b02bf2173e5936
3
+ metadata.gz: a3e94056e45b8404eae96009fa335483fb73199503fc91acb7b479ce9bb82080
4
+ data.tar.gz: 3370e2642ca60032100724e39151ffdefbe59c45b67ed2edd9bdf8d2dc3306b9
5
5
  SHA512:
6
- metadata.gz: e93500c0f42408d751fc35fa9b20c19a05ad564bfda182a7aa6c2cea0acc780af00b425c205dc68d3367d68ac7a0a4bf9ef2050a7a7556ed6a8bf4720a4e6976
7
- data.tar.gz: ee86d6ca6f201c013e22cb26946b0a0826c22cb2fe5452c9a568ab1c80466b1b296df6bb5c61429246907dd9af5b27513469e8775b514b43832c53fa3555d044
6
+ metadata.gz: 3077af8d5234423bde493d62c7e7cd309c687c6c00f2be55bfcecb4ada65006133619cdc440144f9137db9c4dd737c103ea57969b914507ef471cda1cc677b35
7
+ data.tar.gz: e98b9f84cf22cb2cd606cc0888ca3b72e95ac933cfe1674ea0108c3a288462da739fa36321178d7e77d455bf10c021afc99af19ccad22943ffaaf35affef68c7
@@ -44,7 +44,9 @@ module ActiveModel
44
44
  def validate_disposable_email(record, attribute, value, _options)
45
45
  hostname = value.to_s.split(AT_SIGN).last.to_s.downcase
46
46
 
47
- return unless Validators::DisposableHostnames.all.include?(hostname)
47
+ return if Validators::DisposableHostnames.all.none? do |disposable_hostname|
48
+ hostname == disposable_hostname || hostname.end_with?(".#{disposable_hostname}")
49
+ end
48
50
 
49
51
  record.errors.add(
50
52
  attribute,
@@ -4,7 +4,7 @@ module Validators
4
4
  module Version
5
5
  MAJOR = 3
6
6
  MINOR = 0
7
- PATCH = 4
7
+ PATCH = 5
8
8
  STRING = "#{MAJOR}.#{MINOR}.#{PATCH}"
9
9
  end
10
10
  end
@@ -14,6 +14,17 @@ class DisposableEmailTest < Minitest::Test
14
14
  end
15
15
  end
16
16
 
17
+ DISPOSABLE_EMAILS.each do |domain|
18
+ test "rejects disposable e-mail with subdomain (custom.#{domain})" do
19
+ User.validates_email_format_of :email
20
+
21
+ user = User.new(email: "user@custom.#{domain}")
22
+ user.valid?
23
+
24
+ assert_includes user.errors[:email], I18n.t("activerecord.errors.messages.disposable_email")
25
+ end
26
+ end
27
+
17
28
  test "accepts disposable e-mail" do
18
29
  User.validates_email_format_of :email, disposable: true
19
30
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: validators
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.0.4
4
+ version: 3.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nando Vieira