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:
Diffstat (limited to 'app/validators/email_validator.rb')
-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