spree_core 2.1.8 → 2.1.9
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/spree/core/validators/email.rb +1 -23
- data/lib/spree/core/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bef9bb6cb651e122c3dd179632b3cd03db25db5c
|
4
|
+
data.tar.gz: 847f17d74a32fd42dc00d455663908d9a7b161d7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 466fb2ea2e0628e982dfbced5a7f6ceac9b3c8889ce10b65f63b92c5804636731eb69c0a728cc096d47d4d1e8d16a32914605d131d71746ed8a1f80558cca279
|
7
|
+
data.tar.gz: e30d22e469863e8eac638e5700dc094aed9db9f5e518ac976b6607d7feee5a3b74fddb30e26586d9e4213b6cec4246ba0f1b1602a8d307fc7506a0b2bacc76a4
|
@@ -1,29 +1,7 @@
|
|
1
|
-
# Borrowed from http://my.rails-royce.org/2010/07/21/email-validation-in-ruby-on-rails-without-regexp/
|
2
|
-
# Mentioned in tweet here: https://twitter.com/_sohara/status/177120126083141633
|
3
|
-
require 'mail'
|
4
1
|
class EmailValidator < ActiveModel::EachValidator
|
5
2
|
def validate_each(record,attribute,value)
|
6
|
-
unless
|
3
|
+
unless value =~ /\A[^@\s]+@([^@\s]+\.)+[^@\s]+\z/
|
7
4
|
record.errors.add(attribute, :invalid, {:value => value}.merge!(options))
|
8
5
|
end
|
9
6
|
end
|
10
|
-
|
11
|
-
def valid?(email)
|
12
|
-
begin
|
13
|
-
m = Mail::Address.new(email)
|
14
|
-
# We must check that value contains a domain and that value is an email address
|
15
|
-
r = m.domain && m.address == email
|
16
|
-
t = m.__send__(:tree)
|
17
|
-
# We need to dig into treetop
|
18
|
-
# A valid domain must have dot_atom_text elements size > 1
|
19
|
-
# user@localhost is excluded
|
20
|
-
# treetop must respond to domain
|
21
|
-
# We exclude valid email values like <user@localhost.com>
|
22
|
-
# Hence we use m.__send__(tree).domain
|
23
|
-
r &&= (t.domain.dot_atom_text.elements.size > 1)
|
24
|
-
rescue Exception => e
|
25
|
-
r = false
|
26
|
-
end
|
27
|
-
r
|
28
|
-
end
|
29
7
|
end
|
data/lib/spree/core/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: spree_core
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.1.
|
4
|
+
version: 2.1.9
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sean Schofield
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-09-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activemerchant
|