diff options
author | Rémy Coutable <remy@rymai.me> | 2016-02-09 17:59:47 +0100 |
---|---|---|
committer | Rémy Coutable <remy@rymai.me> | 2016-02-09 18:15:35 +0100 |
commit | b3635ee46a1e62d72ce84871e2a5984e6eabfbdf (patch) | |
tree | da9f077646a7baa0b0aee9f7c2412fe271ac9814 /app/validators | |
parent | b34963bc125d11af7b9c993d1233258f084e580d (diff) | |
download | gitlab-ce-b3635ee46a1e62d72ce84871e2a5984e6eabfbdf.tar.gz |
Re-add EmailValidator to avoid the repetition of format: { with: Devise.email_regexp }streamline-email-validation
Diffstat (limited to 'app/validators')
-rw-r--r-- | app/validators/email_validator.rb | 5 |
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 |