roomorama-validates_email 0.3 → 0.3.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/validates_email/email_validator.rb +5 -2
- data/lib/validates_email/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b29f15f9211a9ba258a444d4eff61887241aa59e
|
4
|
+
data.tar.gz: d3a2a29717552ce7672eae767d7604e81eff08ac
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2fe40360f5ca4d71b98781f5ccab75cb585bcb2b78607772509ba3c5ffa4dfb233b5df4a0baff60bcf86adf990eb39e83969d5b902ae786746c74fdf88654459
|
7
|
+
data.tar.gz: 80f447ef1f0c2694288d2b359c0c5f84608760e23df7d4d2b819619b3a9e318579f96dfcec84a7152d4c8505294bea9c78042b63d690d2ebe507237d12aac1fb
|
@@ -22,10 +22,13 @@ class EmailValidator < ActiveModel::EachValidator
|
|
22
22
|
#
|
23
23
|
def validate_each(record, attribute, value)
|
24
24
|
if validates_email_format(value)
|
25
|
-
|
25
|
+
validate_mailgun = options[:mailgun] && options[:mailgun].respond_to?(:call) ? options[:mailgun].call(record) : options[:mailgun]
|
26
|
+
if validate_mailgun && ENV['MAILGUN_PUBLIC_KEY'].present? && !validates_email_with_mailgun(value)
|
26
27
|
record.errors.add(attribute, options[:mailgun_message] || :invalid)
|
27
28
|
end
|
28
|
-
|
29
|
+
validate_mx_condition = options[:mx] && options[:mx].is_a?(Hash) ? (options[:mx][:if].nil? ? true : options[:mx][:if]) : options[:mx]
|
30
|
+
validate_mx = validate_mx_condition && validate_mx_condition.respond_to?(:call) ? validate_mx_condition.call(record) : validate_mx_condition
|
31
|
+
if validate_mx && !validates_email_domain(value, options[:mx])
|
29
32
|
record.errors.add(attribute, options[:mx_message] || :mx_invalid)
|
30
33
|
end
|
31
34
|
else
|