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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a3e94056e45b8404eae96009fa335483fb73199503fc91acb7b479ce9bb82080
|
4
|
+
data.tar.gz: 3370e2642ca60032100724e39151ffdefbe59c45b67ed2edd9bdf8d2dc3306b9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
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,
|
data/lib/validators/version.rb
CHANGED
@@ -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
|
|