Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRémy Coutable <remy@rymai.me>2016-02-09 19:59:47 +0300
committerRémy Coutable <remy@rymai.me>2016-02-09 20:15:35 +0300
commitb3635ee46a1e62d72ce84871e2a5984e6eabfbdf (patch)
treeda9f077646a7baa0b0aee9f7c2412fe271ac9814 /app/validators
parentb34963bc125d11af7b9c993d1233258f084e580d (diff)
Re-add EmailValidator to avoid the repetition of format: { with: Devise.email_regexp }
Diffstat (limited to 'app/validators')
-rw-r--r--app/validators/email_validator.rb5
1 files changed, 5 insertions, 0 deletions
diff --git a/app/validators/email_validator.rb b/app/validators/email_validator.rb
new file mode 100644
index 00000000000..aab07a7ece4
--- /dev/null
+++ b/app/validators/email_validator.rb
@@ -0,0 +1,5 @@
+class EmailValidator < ActiveModel::EachValidator
+ def validate_each(record, attribute, value)
+ record.errors.add(attribute, :invalid) unless value =~ Devise.email_regexp
+ end
+end