diff options
author | Douwe Maan <douwe@gitlab.com> | 2015-12-08 08:42:17 +0000 |
---|---|---|
committer | Douwe Maan <douwe@gitlab.com> | 2015-12-08 08:42:17 +0000 |
commit | f5430e48b42227f1c1874ca27c6907f0f704be28 (patch) | |
tree | 3f9f71598586e1b2963ad00b92d80555d1fb8377 /lib | |
parent | 1d605f63650ca7dfedb766d41cf15f33f0bd2e51 (diff) | |
parent | 2379c8beeac600c3352e33fda0c2b4f4f39c8b84 (diff) | |
download | gitlab-ce-f5430e48b42227f1c1874ca27c6907f0f704be28.tar.gz |
Merge branch 'rs-validators' into 'master'
Add more custom validators
These custom validators allow us to DRY up our models a bit.
See merge request !1944
Diffstat (limited to 'lib')
-rw-r--r-- | lib/email_validator.rb | 21 | ||||
-rw-r--r-- | lib/gitlab/blacklist.rb | 34 |
2 files changed, 0 insertions, 55 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 diff --git a/lib/gitlab/blacklist.rb b/lib/gitlab/blacklist.rb deleted file mode 100644 index 43145e0ee1b..00000000000 --- a/lib/gitlab/blacklist.rb +++ /dev/null @@ -1,34 +0,0 @@ -module Gitlab - module Blacklist - extend self - - def path - %w( - admin - dashboard - files - groups - help - profile - projects - search - public - assets - u - s - teams - merge_requests - issues - users - snippets - services - repository - hooks - notes - unsubscribes - all - ci - ) - end - end -end |