diff options
author | Robert Speicher <rspeicher@gmail.com> | 2015-12-01 18:46:00 -0500 |
---|---|---|
committer | Robert Speicher <rspeicher@gmail.com> | 2015-12-07 16:57:26 -0500 |
commit | b3200c8c44f2351d88d5d78d7ded3ac06001bd7c (patch) | |
tree | 0873ea7a0f3bc11096ae49224db15a00e2c21959 /lib | |
parent | d5ea93469b4ec95916361c61876c949f60539211 (diff) | |
download | gitlab-ce-b3200c8c44f2351d88d5d78d7ded3ac06001bd7c.tar.gz |
Move EmailValidator to app/validators
Diffstat (limited to 'lib')
-rw-r--r-- | lib/email_validator.rb | 21 |
1 files changed, 0 insertions, 21 deletions
diff --git a/lib/email_validator.rb b/lib/email_validator.rb deleted file mode 100644 index f509f0a5843..00000000000 --- a/lib/email_validator.rb +++ /dev/null @@ -1,21 +0,0 @@ -# Based on https://github.com/balexand/email_validator -# -# Extended to use only strict mode with following allowed characters: -# ' - apostrophe -# -# See http://www.remote.org/jochen/mail/info/chars.html -# -class EmailValidator < ActiveModel::EachValidator - @@default_options = {} - - def self.default_options - @@default_options - end - - def validate_each(record, attribute, value) - options = @@default_options.merge(self.options) - unless value =~ /\A\s*([-a-z0-9+._']{1,64})@((?:[-a-z0-9]+\.)+[a-z]{2,})\s*\z/i - record.errors.add(attribute, options[:message] || :invalid) - end - end -end |