Add ability to run validation on site settings. notification_email and other email address settings are now validated.

This commit is contained in:
Neil Lalonde
2014-06-09 15:17:36 -04:00
parent 8e882ad145
commit c61462662b
10 changed files with 100 additions and 10 deletions

View File

@ -21,4 +21,8 @@ class EmailValidator < ActiveModel::EachValidator
value =~ regexp
end
def self.email_regex
/^[a-zA-Z0-9!#$%&'*+\/=?\^_`{|}~\-]+(?:\.[a-zA-Z0-9!#$%&'\*+\/=?\^_`{|}~\-]+)*@(?:[a-zA-Z0-9](?:[a-zA-Z0-9\-]*[a-zA-Z0-9])?\.)+[a-zA-Z0-9](?:[a-zA-Z0-9\-]*[a-zA-Z0-9])?$/
end
end